blob: 50259957eb15477918ef6f1ed7d055c47cef7167 [file] [log] [blame]
Derek Schuff263366f2012-10-16 22:30:41 +00001// RUN: %clang_cc1 -triple armv7-unknown-nacl-gnueabi \
2// RUN: -ffreestanding -mfloat-abi hard -target-cpu cortex-a8 \
3// RUN: -emit-llvm -w -o - %s | FileCheck %s
4
5// Test that functions with pnaclcall attribute generate portable bitcode
6// like the le32 arch target
7
8typedef struct {
9 int a;
10 int b;
11} s1;
12// CHECK: define i32 @f48(%struct.s1* byval %s)
13int __attribute__((pnaclcall)) f48(s1 s) { return s.a; }
14
Bill Wendling5e314742013-01-31 23:17:12 +000015// CHECK: define void @f49(%struct.s1* noalias sret %agg.result)
Derek Schuff263366f2012-10-16 22:30:41 +000016s1 __attribute__((pnaclcall)) f49() { s1 s; s.a = s.b = 1; return s; }
17
18union simple_union {
19 int a;
20 char b;
21};
22// Unions should be passed as byval structs
23// CHECK: define void @f50(%union.simple_union* byval %s)
24void __attribute__((pnaclcall)) f50(union simple_union s) {}
25
26typedef struct {
27 int b4 : 4;
28 int b3 : 3;
29 int b8 : 8;
30} bitfield1;
31// Bitfields should be passed as byval structs
32// CHECK: define void @f51(%struct.bitfield1* byval %bf1)
33void __attribute__((pnaclcall)) f51(bitfield1 bf1) {}