blob: bac2fb71a084e15a616bab48c5a949b3d46e05be [file] [log] [blame]
Michael Kuperstein68901882015-10-25 08:18:20 +00001// 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)
4void 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)
7void 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)
10void mixed(int a, float b, int c, float d) {}
11
12// CHECK-LABEL: define void @doubles(double inreg %d1, double %d2)
13void doubles(double d1, double d2) {}
14
15// CHECK-LABEL: define void @mixedDoubles(i32 inreg %a, double inreg %d1)
16void mixedDoubles(int a, double d1) {}
17
18typedef struct st4_t {
19 int a;
20} st4_t;
21
22typedef struct st5_t {
23 int a;
24 char b;
25} st5_t;
26
27typedef 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)
34void 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)
37void 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)
40void 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)
43void largeStructMiddle(int i1, st12_t st, int i2, int i3) {}
44
45// CHECK-LABEL: define i32 @retSmallStruct(i32 inreg %r.coerce)
46st4_t retSmallStruct(st4_t r) { return r; }
47
48// CHECK-LABEL: define i64 @retPaddedStruct(i32 inreg %r.coerce0, i32 inreg %r.coerce1)
49st5_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)
52st12_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, ...)
58int varArgs(int i1, ...) { return i1; }
Andrey Bokhanko158b8b82015-11-02 09:54:17 +000059
60// CHECK-LABEL: define double @longDoubleArg(double %ld1)
61long double longDoubleArg(long double ld1) { return ld1; }
62