1 // RUN: %clang_cc1 -w -triple i386-pc-elfiamcu -mfloat-abi soft -emit-llvm -o - %s | FileCheck %s
2
3 // CHECK-LABEL: define void @ints(i32 inreg %a, i32 inreg %b, i32 inreg %c, i32 %d)
ints(int a,int b,int c,int d)4 void ints(int a, int b, int c, int d) {}
5
6 // CHECK-LABEL: define void @floats(float inreg %a, float inreg %b, float inreg %c, float %d)
floats(float a,float b,float c,float d)7 void floats(float a, float b, float c, float d) {}
8
9 // CHECK-LABEL: define void @mixed(i32 inreg %a, float inreg %b, i32 inreg %c, float %d)
mixed(int a,float b,int c,float d)10 void mixed(int a, float b, int c, float d) {}
11
12 // CHECK-LABEL: define void @doubles(double inreg %d1, double %d2)
doubles(double d1,double d2)13 void doubles(double d1, double d2) {}
14
15 // CHECK-LABEL: define void @mixedDoubles(i32 inreg %a, double inreg %d1)
mixedDoubles(int a,double d1)16 void mixedDoubles(int a, double d1) {}
17
18 typedef struct st4_t {
19 int a;
20 } st4_t;
21
22 typedef struct st5_t {
23 int a;
24 char b;
25 } st5_t;
26
27 typedef struct st12_t {
28 int a;
29 int b;
30 int c;
31 } st12_t;
32
33 // CHECK-LABEL: define void @smallStructs(i32 inreg %st1.coerce, i32 inreg %st2.coerce, i32 inreg %st3.coerce)
smallStructs(st4_t st1,st4_t st2,st4_t st3)34 void smallStructs(st4_t st1, st4_t st2, st4_t st3) {}
35
36 // CHECK-LABEL: define void @paddedStruct(i32 inreg %i1, i32 inreg %st.coerce0, i32 inreg %st.coerce1, i32 %st4.0)
paddedStruct(int i1,st5_t st,st4_t st4)37 void paddedStruct(int i1, st5_t st, st4_t st4) {}
38
39 // CHECK-LABEL: define void @largeStruct(i32 %st.0, i32 %st.1, i32 %st.2)
largeStruct(st12_t st)40 void largeStruct(st12_t st) {}
41
42 // CHECK-LABEL: define void @largeStructMiddle(i32 inreg %i1, i32 %st.0, i32 %st.1, i32 %st.2, i32 inreg %i2, i32 inreg %i3)
largeStructMiddle(int i1,st12_t st,int i2,int i3)43 void largeStructMiddle(int i1, st12_t st, int i2, int i3) {}
44
45 // CHECK-LABEL: define i32 @retSmallStruct(i32 inreg %r.coerce)
retSmallStruct(st4_t r)46 st4_t retSmallStruct(st4_t r) { return r; }
47
48 // CHECK-LABEL: define i64 @retPaddedStruct(i32 inreg %r.coerce0, i32 inreg %r.coerce1)
retPaddedStruct(st5_t r)49 st5_t retPaddedStruct(st5_t r) { return r; }
50
51 // CHECK-LABEL: define void @retLargeStruct(%struct.st12_t* inreg noalias sret %agg.result, i32 inreg %i1, i32 %r.0, i32 %r.1, i32 %r.2)
retLargeStruct(int i1,st12_t r)52 st12_t retLargeStruct(int i1, st12_t r) { return r; }
53
54 // FIXME: We really shouldn't be marking this inreg. Right now the
55 // inreg gets ignored by the CG for varargs functions, but that's
56 // insane.
57 // CHECK-LABEL: define i32 @varArgs(i32 inreg %i1, ...)
varArgs(int i1,...)58 int varArgs(int i1, ...) { return i1; }
59
60 // CHECK-LABEL: define double @longDoubleArg(double inreg %ld1)
longDoubleArg(long double ld1)61 long double longDoubleArg(long double ld1) { return ld1; }
62
63