• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -mtriple=i386-pc-win32 -mattr=+sse | FileCheck --check-prefix=WIN32 %s
2; RUN: llc < %s -mtriple=x86_64-win32 -mattr=+sse | FileCheck --check-prefix=WIN64 %s
3; RUN: llc < %s -mtriple=x86_64-linux-gnu -mattr=+sse | FileCheck --check-prefix=LINUXOSX %s
4
5; WIN32-LABEL:  test_argReti1:
6; WIN32:        incb  %al
7; WIN32:        ret{{.*}}
8
9; WIN64-LABEL:  test_argReti1:
10; WIN64:        incb  %al
11; WIN64:        ret{{.*}}
12
13; Test regcall when receiving/returning i1
14define x86_regcallcc i1 @test_argReti1(i1 %a)  {
15  %add = add i1 %a, 1
16  ret i1 %add
17}
18
19; WIN32-LABEL:  test_CallargReti1:
20; WIN32:        movzbl  %al, %eax
21; WIN32:        call{{.*}}   {{.*}}test_argReti1
22; WIN32:        incb  %al
23; WIN32:        ret{{.*}}
24
25; WIN64-LABEL:  test_CallargReti1:
26; WIN64:        movzbl  %al, %eax
27; WIN64:        call{{.*}}   {{.*}}test_argReti1
28; WIN64:        incb  %al
29; WIN64:        ret{{.*}}
30
31; Test regcall when passing/retrieving i1
32define x86_regcallcc i1 @test_CallargReti1(i1 %a)  {
33  %b = add i1 %a, 1
34  %c = call x86_regcallcc i1 @test_argReti1(i1 %b)
35  %d = add i1 %c, 1
36  ret i1 %d
37}
38
39; WIN64-LABEL: testf32_inp
40; WIN64: movaps {{%xmm(1[2-5])}}, {{.*(%r(b|s)p).*}}  {{#+}} 16-byte Spill
41; WIN64: movaps {{%xmm(1[2-5])}}, {{.*(%r(b|s)p).*}}  {{#+}} 16-byte Spill
42; WIN64: movaps {{%xmm(1[2-5])}}, {{.*(%r(b|s)p).*}}  {{#+}} 16-byte Spill
43; WIN64: movaps {{%xmm(1[2-5])}}, {{.*(%r(b|s)p).*}}  {{#+}} 16-byte Spill
44; WIN64: {{.*}} {{%xmm([0-9]|1[0-1])}}, {{%xmm(1[2-5])}}
45; WIN64: {{.*}} {{%xmm([0-9]|1[0-1])}}, {{%xmm(1[2-5])}}
46; WIN64: {{.*}} {{%xmm([0-9]|1[0-1])}}, {{%xmm(1[2-5])}}
47; WIN64: {{.*}} {{%xmm([0-9]|1[0-1])}}, {{%xmm(1[2-5])}}
48; WIN64: movaps {{.*(%r(b|s)p).*}}, {{%xmm(1[2-5])}}  {{#+}} 16-byte Reload
49; WIN64: movaps {{.*(%r(b|s)p).*}}, {{%xmm(1[2-5])}}  {{#+}} 16-byte Reload
50; WIN64: movaps {{.*(%r(b|s)p).*}}, {{%xmm(1[2-5])}}  {{#+}} 16-byte Reload
51; WIN64: movaps {{.*(%r(b|s)p).*}}, {{%xmm(1[2-5])}}  {{#+}} 16-byte Reload
52; WIN64: retq
53
54; WIN32-LABEL: testf32_inp
55; WIN32: movaps {{%xmm([0-7])}}, {{.*(%e(b|s)p).*}}  {{#+}} 16-byte Spill
56; WIN32: {{.*}} {{%xmm[0-7]}}, {{%xmm[4-7]}}
57; WIN32: {{.*}} {{%xmm[0-7]}}, {{%xmm[4-7]}}
58; WIN32: {{.*}} {{%xmm[0-7]}}, {{%xmm[4-7]}}
59; WIN32: {{.*}} {{%xmm[0-7]}}, {{%xmm[4-7]}}
60; WIN32: movaps {{.*(%e(b|s)p).*}}, {{%xmm([0-7])}}  {{#+}} 16-byte Reload
61; WIN32: retl
62
63; LINUXOSX-LABEL: testf32_inp
64; LINUXOSX: movaps {{%xmm(1[2-5])}}, {{.*(%r(b|s)p).*}}  {{#+}} 16-byte Spill
65; LINUXOSX: movaps {{%xmm(1[2-5])}}, {{.*(%r(b|s)p).*}}  {{#+}} 16-byte Spill
66; LINUXOSX: movaps {{%xmm(1[2-5])}}, {{.*(%r(b|s)p).*}}  {{#+}} 16-byte Spill
67; LINUXOSX: movaps {{%xmm(1[2-5])}}, {{.*(%r(b|s)p).*}}  {{#+}} 16-byte Spill
68; LINUXOSX: {{.*}} {{%xmm([0-9]|1[0-1])}}, {{%xmm(1[2-5])}}
69; LINUXOSX: {{.*}} {{%xmm([0-9]|1[0-1])}}, {{%xmm(1[2-5])}}
70; LINUXOSX: {{.*}} {{%xmm([0-9]|1[0-1])}}, {{%xmm(1[2-5])}}
71; LINUXOSX: {{.*}} {{%xmm([0-9]|1[0-1])}}, {{%xmm(1[2-5])}}
72; LINUXOSX: movaps {{.*(%r(b|s)p).*}}, {{%xmm(1[2-5])}}  {{#+}} 16-byte Reload
73; LINUXOSX: movaps {{.*(%r(b|s)p).*}}, {{%xmm(1[2-5])}}  {{#+}} 16-byte Reload
74; LINUXOSX: movaps {{.*(%r(b|s)p).*}}, {{%xmm(1[2-5])}}  {{#+}} 16-byte Reload
75; LINUXOSX: movaps {{.*(%r(b|s)p).*}}, {{%xmm(1[2-5])}}  {{#+}} 16-byte Reload
76; LINUXOSX: retq
77
78;test calling conventions - input parameters, callee saved xmms
79define x86_regcallcc <16 x float> @testf32_inp(<16 x float> %a, <16 x float> %b, <16 x float> %c) nounwind {
80  %x1 = fadd <16 x float> %a, %b
81  %x2 = fmul <16 x float> %a, %b
82  %x3 = fsub <16 x float> %x1, %x2
83  %x4 = fadd <16 x float> %x3, %c
84  ret <16 x float> %x4
85}
86
87; WIN32-LABEL: testi32_inp
88; WIN32: pushl {{%e(si|di|bx|bp)}}
89; WIN32: pushl {{%e(si|di|bx|bp)}}
90; WIN32: popl {{%e(si|di|bx|bp)}}
91; WIN32: popl {{%e(si|di|bx|bp)}}
92; WIN32: retl
93
94; WIN64-LABEL: testi32_inp
95; WIN64: pushq	{{%r(bp|bx|1[0-5])}}
96; WIN64: pushq	{{%r(bp|bx|1[0-5])}}
97; WIN64: pushq	{{%r(bp|bx|1[0-5])}}
98; WIN64: popq	{{%r(bp|bx|1[0-5])}}
99; WIN64: popq	{{%r(bp|bx|1[0-5])}}
100; WIN64: popq	{{%r(bp|bx|1[0-5])}}
101; WIN64: retq
102
103; LINUXOSX-LABEL: testi32_inp
104; LINUXOSX: pushq	{{%r(bp|bx|1[2-5])}}
105; LINUXOSX: pushq	{{%r(bp|bx|1[2-5])}}
106; LINUXOSX: popq	{{%r(bp|bx|1[2-5])}}
107; LINUXOSX: popq	{{%r(bp|bx|1[2-5])}}
108; LINUXOSX: retq
109
110;test calling conventions - input parameters, callee saved GPRs
111define x86_regcallcc i32 @testi32_inp(i32 %a1, i32 %a2, i32 %a3, i32 %a4, i32 %a5, i32 %a6,
112                                      i32 %b1, i32 %b2, i32 %b3, i32 %b4, i32 %b5, i32 %b6) nounwind {
113  %x1 = sub i32 %a1, %a2
114  %x2 = sub i32 %a3, %a4
115  %x3 = sub i32 %a5, %a6
116  %y1 = sub i32 %b1, %b2
117  %y2 = sub i32 %b3, %b4
118  %y3 = sub i32 %b5, %b6
119  %v1 = add i32 %a1, %a2
120  %v2 = add i32 %a3, %a4
121  %v3 = add i32 %a5, %a6
122  %w1 = add i32 %b1, %b2
123  %w2 = add i32 %b3, %b4
124  %w3 = add i32 %b5, %b6
125  %s1 = mul i32 %x1, %y1
126  %s2 = mul i32 %x2, %y2
127  %s3 = mul i32 %x3, %y3
128  %t1 = mul i32 %v1, %w1
129  %t2 = mul i32 %v2, %w2
130  %t3 = mul i32 %v3, %w3
131  %m1 = add i32 %s1, %s2
132  %m2 = add i32 %m1, %s3
133  %n1 = add i32 %t1, %t2
134  %n2 = add i32 %n1, %t3
135  %r1 = add i32 %m2, %n2
136  ret i32 %r1
137}
138
139; X32: testf32_stack
140; X32: movaps {{%xmm([0-7])}}, {{(-*[0-9])+}}(%ebp)
141; X32: movaps {{%xmm([0-7])}}, {{(-*[0-9])+}}(%ebp)
142; X32: movaps {{%xmm([0-7])}}, {{(-*[0-9])+}}(%ebp)
143; X32: movaps {{%xmm([0-7])}}, {{(-*[0-9])+}}(%ebp)
144; X32: addps {{([0-9])+}}(%ebp), {{%xmm([0-7])}}
145; X32: addps {{([0-9])+}}(%ebp), {{%xmm([0-7])}}
146; X32: addps {{([0-9])+}}(%ebp), {{%xmm([0-7])}}
147; X32: addps {{([0-9])+}}(%ebp), {{%xmm([0-7])}}
148; X32: addps {{([0-9])+}}(%ebp), {{%xmm([0-7])}}
149; X32: addps {{([0-9])+}}(%ebp), {{%xmm([0-7])}}
150; X32: addps {{([0-9])+}}(%ebp), {{%xmm([0-7])}}
151; X32: addps {{([0-9])+}}(%ebp), {{%xmm([0-7])}}
152; X32: addps {{([0-9])+}}(%ebp), {{%xmm([0-7])}}
153; X32: addps {{([0-9])+}}(%ebp), {{%xmm([0-7])}}
154; X32: addps {{([0-9])+}}(%ebp), {{%xmm([0-7])}}
155; X32: addps {{([0-9])+}}(%ebp), {{%xmm([0-7])}}
156; X32: addps {{([0-9])+}}(%ebp), {{%xmm([0-7])}}
157; X32: addps {{([0-9])+}}(%ebp), {{%xmm([0-7])}}
158; X32: addps {{([0-9])+}}(%ebp), {{%xmm([0-7])}}
159; X32: addps {{([0-9])+}}(%ebp), {{%xmm([0-7])}}
160; X32: movaps {{(-*[0-9])+}}(%ebp), {{%xmm([0-7])}}
161; X32: movaps {{(-*[0-9])+}}(%ebp), {{%xmm([0-7])}}
162; X32: movaps {{(-*[0-9])+}}(%ebp), {{%xmm([0-7])}}
163; X32: movaps {{(-*[0-9])+}}(%ebp), {{%xmm([0-7])}}
164
165; LINUXOSX: testf32_stack
166; LINUXOSX: addps {{%xmm([0-9]+)}}, {{%xmm([0-9]+)}}
167; LINUXOSX: addps {{%xmm([0-9]+)}}, {{%xmm([0-9]+)}}
168; LINUXOSX: addps {{%xmm([0-9]+)}}, {{%xmm([0-9]+)}}
169; LINUXOSX: addps {{%xmm([0-9]+)}}, {{%xmm([0-9]+)}}
170; LINUXOSX: addps {{%xmm([0-9]+)}}, {{%xmm([0-9]+)}}
171; LINUXOSX: addps {{%xmm([0-9]+)}}, {{%xmm([0-9]+)}}
172; LINUXOSX: addps {{%xmm([0-9]+)}}, {{%xmm([0-9]+)}}
173; LINUXOSX: addps {{%xmm([0-9]+)}}, {{%xmm([0-9]+)}}
174; LINUXOSX: addps {{([0-9])+}}(%rsp), {{%xmm([0-7])}}
175; LINUXOSX: addps {{([0-9])+}}(%rsp), {{%xmm([0-7])}}
176; LINUXOSX: addps {{([0-9])+}}(%rsp), {{%xmm([0-7])}}
177; LINUXOSX: addps {{([0-9])+}}(%rsp), {{%xmm([0-7])}}
178; LINUXOSX: addps {{([0-9])+}}(%rsp), {{%xmm([0-7])}}
179; LINUXOSX: addps {{([0-9])+}}(%rsp), {{%xmm([0-7])}}
180; LINUXOSX: addps {{([0-9])+}}(%rsp), {{%xmm([0-7])}}
181; LINUXOSX: addps {{([0-9])+}}(%rsp), {{%xmm([0-7])}}
182; LINUXOSX: retq
183
184; Test that parameters, overflowing register capacity, are passed through the stack
185define x86_regcallcc <32 x float> @testf32_stack(<32 x float> %a, <32 x float> %b, <32 x float> %c) nounwind {
186  %x1 = fadd <32 x float> %a, %b
187  %x2 = fadd <32 x float> %x1, %c
188  ret <32 x float> %x2
189}
190