1 | // RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -o - | FileCheck %s |
2 | |
3 | __attribute__((regparm(3))) void f1(int a, int b, int c, int d); |
4 | // CHECK: declare void @f1(i32 inreg, i32 inreg, i32 inreg, i32) |
5 | void g1() { |
6 | f1(41, 42, 43, 44); |
7 | } |
8 | |
9 | struct s1 { |
10 | int x1; |
11 | }; |
12 | __attribute__((regparm(3))) void f2(int a, int b, struct s1 c, int d); |
13 | // CHECK: declare void @f2(i32 inreg, i32 inreg, i32 inreg, i32) |
14 | void g2() { |
15 | struct s1 x = {43}; |
16 | f2(41, 42, x, 44); |
17 | } |
18 | |
19 | struct s2 { |
20 | int x1; |
21 | int x2; |
22 | }; |
23 | __attribute__((regparm(3))) void f3(int a, int b, struct s2 c, int d); |
24 | // CHECK: declare void @f3(i32 inreg, i32 inreg, i32, i32, i32) |
25 | void g3() { |
26 | struct s2 x = {43, 44}; |
27 | f3(41, 42, x, 45); |
28 | } |
29 | __attribute__((regparm(3))) void f4(int a, struct s2 b, int c); |
30 | // CHECK: declare void @f4(i32 inreg, i32 inreg, i32 inreg, i32) |
31 | void g4() { |
32 | struct s2 x = {42, 43}; |
33 | f4(41, x, 44); |
34 | } |
35 | |
36 | struct s3 { |
37 | int x1; |
38 | int x2; |
39 | int x3; |
40 | }; |
41 | __attribute__((regparm(3))) void f5(int a, struct s3 b, int c); |
42 | // CHECK: declare void @f5(i32 inreg, i32, i32, i32, i32) |
43 | void g5() { |
44 | struct s3 x = {42, 43, 44}; |
45 | f5(41, x, 45); |
46 | } |
47 | __attribute__((regparm(3))) void f6(struct s3 a, int b); |
48 | // CHECK: declare void @f6(i32 inreg, i32 inreg, i32 inreg, i32) |
49 | void g6() { |
50 | struct s3 x = {41, 42, 43}; |
51 | f6(x, 44); |
52 | } |
53 | |
54 | struct s4 { |
55 | int x1; |
56 | int x2; |
57 | int x3; |
58 | int x4; |
59 | }; |
60 | __attribute__((regparm(3))) void f7(struct s4 a, int b); |
61 | // CHECK: declare void @f7(i32, i32, i32, i32, i32) |
62 | void g7() { |
63 | struct s4 x = {41, 42, 43, 44}; |
64 | f7(x, 45); |
65 | } |
66 | |
67 | __attribute__((regparm(3))) void f8(float a, int b); |
68 | // CHECK: declare void @f8(float, i32 inreg) |
69 | void g8(void) { |
70 | f8(41, 42); |
71 | } |
72 | |
73 | struct s5 { |
74 | float x1; |
75 | }; |
76 | __attribute__((regparm(3))) void f9(struct s5 a, int b); |
77 | // CHECK: declare void @f9(float, i32 inreg) |
78 | void g9(void) { |
79 | struct s5 x = {41}; |
80 | f9(x, 42); |
81 | } |
82 | |
83 | struct s6 { |
84 | float x1; |
85 | int x2; |
86 | }; |
87 | __attribute__((regparm(3))) void f10(struct s6 a, int b); |
88 | // CHECK: declare void @f10(i32 inreg, i32 inreg, i32 inreg) |
89 | void g10(void) { |
90 | struct s6 x = {41, 42}; |
91 | f10(x, 43); |
92 | } |
93 | |
94 | struct s7 { |
95 | float x1; |
96 | int x2; |
97 | float x3; |
98 | }; |
99 | __attribute__((regparm(3))) void f11(struct s7 a, int b); |
100 | // CHECK: declare void @f11(i32 inreg, i32 inreg, i32 inreg, i32) |
101 | void g11(void) { |
102 | struct s7 x = {41, 42, 43}; |
103 | f11(x, 44); |
104 | } |
105 | |
106 | struct s8 { |
107 | float x1; |
108 | float x2; |
109 | }; |
110 | __attribute__((regparm(3))) void f12(struct s8 a, int b); |
111 | // CHECK: declare void @f12(i32 inreg, i32 inreg, i32 inreg) |
112 | void g12(void) { |
113 | struct s8 x = {41, 42}; |
114 | f12(x, 43); |
115 | } |
116 | |
117 | struct s9 { |
118 | float x1; |
119 | float x2; |
120 | float x3; |
121 | }; |
122 | __attribute__((regparm(3))) void f13(struct s9 a, int b); |
123 | // CHECK: declare void @f13(i32 inreg, i32 inreg, i32 inreg, i32) |
124 | void g13(void) { |
125 | struct s9 x = {41, 42, 43}; |
126 | f13(x, 44); |
127 | } |
128 | |
129 | struct s10 { |
130 | double x1; |
131 | }; |
132 | __attribute__((regparm(3))) void f14(struct s10 a, int b, int c); |
133 | // CHECK: declare void @f14(double, i32 inreg, i32 inreg) |
134 | void g14(void) { |
135 | struct s10 x = { 41 }; |
136 | f14(x, 42, 43); |
137 | } |
138 | |
139 | struct s11 { |
140 | double x1; |
141 | double x2; |
142 | }; |
143 | __attribute__((regparm(3))) void f15(struct s11 a, int b); |
144 | // CHECK: declare void @f15(double, double, i32) |
145 | void g15(void) { |
146 | struct s11 x = { 41, 42 }; |
147 | f15(x, 43); |
148 | } |
149 | |
150 | struct s12 { |
151 | double x1; |
152 | float x2; |
153 | }; |
154 | __attribute__((regparm(3))) void f16(struct s12 a, int b); |
155 | // CHECK: declare void @f16(i32 inreg, i32 inreg, i32 inreg, i32) |
156 | void g16(void) { |
157 | struct s12 x = { 41, 42 }; |
158 | f16(x, 43); |
159 | } |
160 | |
161 | __attribute__((regparm(3))) struct s12 f17(int a, int b, int c); |
162 | // CHECK: declare void @f17(%struct.s12* inreg sret, i32 inreg, i32 inreg, i32) |
163 | void g17(void) { |
164 | f17(41, 42, 43); |
165 | } |
166 | |
167 | struct s13 { |
168 | struct inner { |
169 | float x; |
170 | } y; |
171 | }; |
172 | __attribute__((regparm(3))) void f18(struct s13 a, int b, int c, int d); |
173 | // CHECK: declare void @f18(%struct.s13* byval align 4, i32 inreg, i32 inreg, i32 inreg) |
174 | void g18(void) { |
175 | struct s13 x = {{41}}; |
176 | f18(x, 42, 43, 44); |
177 | } |
178 | |