Home | History | Annotate | Download | only in CodeGen
      1 // RUN: %clang_cc1 -triple armv7-apple-darwin9 -target-abi apcs-gnu -emit-llvm -w -o - %s | FileCheck -check-prefix=APCS-GNU %s
      2 // RUN: %clang_cc1 -triple armv7-apple-darwin9 -target-abi aapcs -emit-llvm -w -o - %s | FileCheck -check-prefix=AAPCS %s
      3 
      4 // APCS-GNU: define signext i8 @f0()
      5 // AAPCS: define arm_aapcscc signext i8 @f0()
      6 char f0(void) {
      7   return 0;
      8 }
      9 
     10 // APCS-GNU: define i8 @f1()
     11 // AAPCS: define arm_aapcscc i8 @f1()
     12 struct s1 { char f0; };
     13 struct s1 f1(void) {}
     14 
     15 // APCS-GNU: define i16 @f2()
     16 // AAPCS: define arm_aapcscc i16 @f2()
     17 struct s2 { short f0; };
     18 struct s2 f2(void) {}
     19 
     20 // APCS-GNU: define i32 @f3()
     21 // AAPCS: define arm_aapcscc i32 @f3()
     22 struct s3 { int f0; };
     23 struct s3 f3(void) {}
     24 
     25 // APCS-GNU: define i32 @f4()
     26 // AAPCS: define arm_aapcscc i32 @f4()
     27 struct s4 { struct s4_0 { int f0; } f0; };
     28 struct s4 f4(void) {}
     29 
     30 // APCS-GNU: define void @f5(
     31 // APCS-GNU: struct.s5* noalias sret
     32 // AAPCS: define arm_aapcscc i32 @f5()
     33 struct s5 { struct { } f0; int f1; };
     34 struct s5 f5(void) {}
     35 
     36 // APCS-GNU: define void @f6(
     37 // APCS-GNU: struct.s6* noalias sret
     38 // AAPCS: define arm_aapcscc i32 @f6()
     39 struct s6 { int f0[1]; };
     40 struct s6 f6(void) {}
     41 
     42 // APCS-GNU: define void @f7()
     43 // AAPCS: define arm_aapcscc void @f7()
     44 struct s7 { struct { int : 0; } f0; };
     45 struct s7 f7(void) {}
     46 
     47 // APCS-GNU: define void @f8(
     48 // APCS-GNU: struct.s8* noalias sret
     49 // AAPCS: define arm_aapcscc void @f8()
     50 struct s8 { struct { int : 0; } f0[1]; };
     51 struct s8 f8(void) {}
     52 
     53 // APCS-GNU: define i32 @f9()
     54 // AAPCS: define arm_aapcscc i32 @f9()
     55 struct s9 { int f0; int : 0; };
     56 struct s9 f9(void) {}
     57 
     58 // APCS-GNU: define i32 @f10()
     59 // AAPCS: define arm_aapcscc i32 @f10()
     60 struct s10 { int f0; int : 0; int : 0; };
     61 struct s10 f10(void) {}
     62 
     63 // APCS-GNU: define void @f11(
     64 // APCS-GNU: struct.s11* noalias sret
     65 // AAPCS: define arm_aapcscc i32 @f11()
     66 struct s11 { int : 0; int f0; };
     67 struct s11 f11(void) {}
     68 
     69 // APCS-GNU: define i32 @f12()
     70 // AAPCS: define arm_aapcscc i32 @f12()
     71 union u12 { char f0; short f1; int f2; };
     72 union u12 f12(void) {}
     73 
     74 // APCS-GNU: define void @f13(
     75 // APCS-GNU: struct.s13* noalias sret
     76 
     77 // FIXME: This should return a float.
     78 // AAPCS-FIXME: darm_aapcscc efine float @f13()
     79 struct s13 { float f0; };
     80 struct s13 f13(void) {}
     81 
     82 // APCS-GNU: define void @f14(
     83 // APCS-GNU: union.u14* noalias sret
     84 // AAPCS: define arm_aapcscc i32 @f14()
     85 union u14 { float f0; };
     86 union u14 f14(void) {}
     87 
     88 // APCS-GNU: define void @f15()
     89 // AAPCS: define arm_aapcscc void @f15()
     90 void f15(struct s7 a0) {}
     91 
     92 // APCS-GNU: define void @f16()
     93 // AAPCS: define arm_aapcscc void @f16()
     94 void f16(struct s8 a0) {}
     95 
     96 // APCS-GNU: define i32 @f17()
     97 // AAPCS: define arm_aapcscc i32 @f17()
     98 struct s17 { short f0 : 13; char f1 : 4; };
     99 struct s17 f17(void) {}
    100 
    101 // APCS-GNU: define i32 @f18()
    102 // AAPCS: define arm_aapcscc i32 @f18()
    103 struct s18 { short f0; char f1 : 4; };
    104 struct s18 f18(void) {}
    105 
    106 // APCS-GNU: define void @f19(
    107 // APCS-GNU: struct.s19* noalias sret
    108 // AAPCS: define arm_aapcscc i32 @f19()
    109 struct s19 { int f0; struct s8 f1; };
    110 struct s19 f19(void) {}
    111 
    112 // APCS-GNU: define void @f20(
    113 // APCS-GNU: struct.s20* noalias sret
    114 // AAPCS: define arm_aapcscc i32 @f20()
    115 struct s20 { struct s8 f1; int f0; };
    116 struct s20 f20(void) {}
    117 
    118 // APCS-GNU: define i8 @f21()
    119 // AAPCS: define arm_aapcscc i32 @f21()
    120 struct s21 { struct {} f1; int f0 : 4; };
    121 struct s21 f21(void) {}
    122 
    123 // APCS-GNU: define i16 @f22()
    124 // APCS-GNU: define i32 @f23()
    125 // APCS-GNU: define i64 @f24()
    126 // APCS-GNU: define i128 @f25()
    127 // APCS-GNU: define i64 @f26()
    128 // APCS-GNU: define i128 @f27()
    129 // AAPCS: define arm_aapcscc i16 @f22()
    130 // AAPCS: define arm_aapcscc i32 @f23()
    131 // AAPCS: define arm_aapcscc void @f24({{.*}} noalias sret
    132 // AAPCS: define arm_aapcscc void @f25({{.*}} noalias sret
    133 // AAPCS: define arm_aapcscc void @f26({{.*}} noalias sret
    134 // AAPCS: define arm_aapcscc void @f27({{.*}} noalias sret
    135 _Complex char       f22(void) {}
    136 _Complex short      f23(void) {}
    137 _Complex int        f24(void) {}
    138 _Complex long long  f25(void) {}
    139 _Complex float      f26(void) {}
    140 _Complex double     f27(void) {}
    141 
    142 // APCS-GNU: define i16 @f28()
    143 // AAPCS: define arm_aapcscc i16 @f28()
    144 struct s28 { _Complex char f0; };
    145 struct s28 f28() {}
    146 
    147 // APCS-GNU: define i32 @f29()
    148 // AAPCS: define arm_aapcscc i32 @f29()
    149 struct s29 { _Complex short f0; };
    150 struct s29 f29() {}
    151 
    152 // APCS-GNU: define void @f30({{.*}} noalias sret
    153 // AAPCS: define arm_aapcscc void @f30({{.*}} noalias sret
    154 struct s30 { _Complex int f0; };
    155 struct s30 f30() {}
    156