Home | History | Annotate | Download | only in CodeGen
      1 // 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 
      8 typedef struct {
      9   int a;
     10   int b;
     11 } s1;
     12 // CHECK: define i32 @f48(%struct.s1* byval %s)
     13 int __attribute__((pnaclcall)) f48(s1 s) { return s.a; }
     14 
     15 // CHECK: define void @f49(%struct.s1* noalias sret %agg.result)
     16 s1 __attribute__((pnaclcall)) f49() { s1 s; s.a = s.b = 1; return s; }
     17 
     18 union 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)
     24 void __attribute__((pnaclcall)) f50(union simple_union s) {}
     25 
     26 typedef 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)
     33 void __attribute__((pnaclcall)) f51(bitfield1 bf1) {}
     34