blob: b31901266e6f0b62e260a80a8d6d413d13f49cbb [file] [log] [blame]
Rafael Espindolab48280b2012-07-31 02:44:24 +00001// 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)
5void g1() {
6 f1(41, 42, 43, 44);
7}
8
9struct 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)
14void g2() {
15 struct s1 x = {43};
16 f2(41, 42, x, 44);
17}
18
19struct 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)
25void 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)
31void g4() {
32 struct s2 x = {42, 43};
33 f4(41, x, 44);
34}
35
36struct 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)
43void 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)
49void g6() {
50 struct s3 x = {41, 42, 43};
51 f6(x, 44);
52}
53
54struct 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)
62void 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)
69void g8(void) {
70 f8(41, 42);
71}
72
73struct s5 {
74 float x1;
75};
76__attribute__((regparm(3))) void f9(struct s5 a, int b);
77// CHECK: declare void @f9(float, i32 inreg)
78void g9(void) {
79 struct s5 x = {41};
80 f9(x, 42);
81}
82
83struct 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)
89void g10(void) {
90 struct s6 x = {41, 42};
91 f10(x, 43);
92}
93
94struct 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)
101void g11(void) {
102 struct s7 x = {41, 42, 43};
103 f11(x, 44);
104}
105
106struct 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)
112void g12(void) {
113 struct s8 x = {41, 42};
114 f12(x, 43);
115}
116
117struct 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)
124void g13(void) {
125 struct s9 x = {41, 42, 43};
126 f13(x, 44);
127}
128
129struct 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)
134void g14(void) {
135 struct s10 x = { 41 };
136 f14(x, 42, 43);
137}
138
139struct 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)
145void g15(void) {
146 struct s11 x = { 41, 42 };
147 f15(x, 43);
148}
149
150struct 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)
156void 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)
163void g17(void) {
164 f17(41, 42, 43);
165}
166
167struct 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)
174void g18(void) {
175 struct s13 x = {{41}};
176 f18(x, 42, 43, 44);
177}