blob: 2196c798bf3e63f540d88bea6634ac6e309ffb8a [file] [log] [blame]
Rafael Espindola28710202011-11-27 18:35:39 +00001// RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -o - | FileCheck %s
2
3
4// CHECK: _Z3fooRi(i32* inreg
5void __attribute__ ((regparm (1))) foo(int &a) {
6}
Rafael Espindola0b4cc952012-10-19 05:04:37 +00007
8struct S1 {
9 int x;
10 S1(const S1 &y);
11};
12
13void __attribute__((regparm(3))) foo2(S1 a, int b);
14// CHECK: declare void @_Z4foo22S1i(%struct.S1* inreg, i32 inreg)
15void bar2(S1 a, int b) {
16 foo2(a, b);
17}
18
19struct S2 {
20 int x;
21};
22
23void __attribute__((regparm(3))) foo3(struct S2 a, int b);
Rafael Espindola5f14fcb2012-10-23 02:04:01 +000024// CHECK: declare void @_Z4foo32S2i(i32 inreg, i32 inreg)
Rafael Espindola0b4cc952012-10-19 05:04:37 +000025void bar3(struct S2 a, int b) {
26 foo3(a, b);
27}
Rafael Espindola5f14fcb2012-10-23 02:04:01 +000028
29struct S3 {
30 struct {
31 struct {} b[0];
32 } a;
33};
34__attribute((regparm(2))) void foo4(S3 a, int b);
Bill Wendlingc1ea4b92013-02-15 05:25:49 +000035// CHECK: declare void @_Z4foo42S3i(%struct.S3* byval align 4, i32 inreg)
Rafael Espindola5f14fcb2012-10-23 02:04:01 +000036void bar3(S3 a, int b) {
37 foo4(a, b);
38}