Skip to content

Commit 20856e5

Browse files
committed
SystemZ: Add sincos intrinsic test
The ZOS run line is mostly broken. update_test_checks seems to not work on it and I have no idea what I'm looking at here. It's not obvious to me what the calls are. I added some checks for the references to the libcalls printed at the end of the module, but didn't check anything in the function body. half also just asserts somewhere.
1 parent 65011f9 commit 20856e5

File tree

1 file changed

+222
-0
lines changed

1 file changed

+222
-0
lines changed
Lines changed: 222 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,222 @@
1+
; RUN: llc -mtriple=s390x-linux-gnu < %s | FileCheck -check-prefix=LINUX %s
2+
; RUN: llc -mtriple=s390x-ibm-zos < %s | FileCheck -check-prefix=ZOS %s
3+
4+
; FIXME: Check ZOS function content
5+
6+
; FIXME: half broken
7+
; define { half, half } @test_sincos_f16(half %a) #0 {
8+
; %result = call { half, half } @llvm.sincos.f16(half %a)
9+
; ret { half, half } %result
10+
; }
11+
12+
; define half @test_sincos_f16_only_use_sin(half %a) #0 {
13+
; %result = call { half, half } @llvm.sincos.f16(half %a)
14+
; %result.0 = extractvalue { half, half } %result, 0
15+
; ret half %result.0
16+
; }
17+
18+
; define half @test_sincos_f16_only_use_cos(half %a) #0 {
19+
; %result = call { half, half } @llvm.sincos.f16(half %a)
20+
; %result.1 = extractvalue { half, half } %result, 1
21+
; ret half %result.1
22+
; }
23+
24+
; define { <2 x half>, <2 x half> } @test_sincos_v2f16(<2 x half> %a) #0 {
25+
; %result = call { <2 x half>, <2 x half> } @llvm.sincos.v2f16(<2 x half> %a)
26+
; ret { <2 x half>, <2 x half> } %result
27+
; }
28+
29+
define { float, float } @test_sincos_f32(float %a) #0 {
30+
; LINUX-LABEL: test_sincos_f32:
31+
; LINUX: # %bb.0:
32+
; LINUX-NEXT: stmg %r14, %r15, 112(%r15)
33+
; LINUX-NEXT: aghi %r15, -168
34+
; LINUX-NEXT: la %r2, 164(%r15)
35+
; LINUX-NEXT: la %r3, 160(%r15)
36+
; LINUX-NEXT: brasl %r14, sincosf@PLT
37+
; LINUX-NEXT: le %f0, 164(%r15)
38+
; LINUX-NEXT: le %f2, 160(%r15)
39+
; LINUX-NEXT: lmg %r14, %r15, 280(%r15)
40+
; LINUX-NEXT: br %r14
41+
%result = call { float, float } @llvm.sincos.f32(float %a)
42+
ret { float, float } %result
43+
}
44+
45+
define { <2 x float>, <2 x float> } @test_sincos_v2f32(<2 x float> %a) #0 {
46+
; LINUX-LABEL: test_sincos_v2f32:
47+
; LINUX: # %bb.0:
48+
; LINUX-NEXT: stmg %r14, %r15, 112(%r15)
49+
; LINUX-NEXT: aghi %r15, -184
50+
; LINUX-NEXT: std %f8, 176(%r15) # 8-byte Spill
51+
; LINUX-NEXT: la %r2, 164(%r15)
52+
; LINUX-NEXT: la %r3, 160(%r15)
53+
; LINUX-NEXT: ler %f8, %f2
54+
; LINUX-NEXT: brasl %r14, sincosf@PLT
55+
; LINUX-NEXT: la %r2, 172(%r15)
56+
; LINUX-NEXT: la %r3, 168(%r15)
57+
; LINUX-NEXT: ler %f0, %f8
58+
; LINUX-NEXT: brasl %r14, sincosf@PLT
59+
; LINUX-NEXT: le %f0, 164(%r15)
60+
; LINUX-NEXT: le %f2, 172(%r15)
61+
; LINUX-NEXT: le %f4, 160(%r15)
62+
; LINUX-NEXT: le %f6, 168(%r15)
63+
; LINUX-NEXT: ld %f8, 176(%r15) # 8-byte Reload
64+
; LINUX-NEXT: lmg %r14, %r15, 296(%r15)
65+
; LINUX-NEXT: br %r14
66+
%result = call { <2 x float>, <2 x float> } @llvm.sincos.v2f32(<2 x float> %a)
67+
ret { <2 x float>, <2 x float> } %result
68+
}
69+
70+
define { <3 x float>, <3 x float> } @test_sincos_v3f32(<3 x float> %a) #0 {
71+
; LINUX-LABEL: test_sincos_v3f32:
72+
; LINUX: # %bb.0:
73+
; LINUX-NEXT: stmg %r13, %r15, 104(%r15)
74+
; LINUX-NEXT: aghi %r15, -192
75+
; LINUX-NEXT: std %f8, 184(%r15) # 8-byte Spill
76+
; LINUX-NEXT: std %f9, 176(%r15) # 8-byte Spill
77+
; LINUX-NEXT: lgr %r13, %r2
78+
; LINUX-NEXT: la %r2, 164(%r15)
79+
; LINUX-NEXT: la %r3, 160(%r15)
80+
; LINUX-NEXT: ler %f8, %f4
81+
; LINUX-NEXT: ler %f9, %f2
82+
; LINUX-NEXT: brasl %r14, sincosf@PLT
83+
; LINUX-NEXT: la %r2, 172(%r15)
84+
; LINUX-NEXT: la %r3, 168(%r15)
85+
; LINUX-NEXT: ler %f0, %f9
86+
; LINUX-NEXT: brasl %r14, sincosf@PLT
87+
; LINUX-NEXT: la %r2, 8(%r13)
88+
; LINUX-NEXT: la %r3, 24(%r13)
89+
; LINUX-NEXT: ler %f0, %f8
90+
; LINUX-NEXT: brasl %r14, sincosf@PLT
91+
; LINUX-NEXT: le %f0, 164(%r15)
92+
; LINUX-NEXT: le %f1, 172(%r15)
93+
; LINUX-NEXT: le %f2, 160(%r15)
94+
; LINUX-NEXT: lgdr %r0, %f0
95+
; LINUX-NEXT: lgdr %r1, %f1
96+
; LINUX-NEXT: lgdr %r2, %f2
97+
; LINUX-NEXT: le %f0, 168(%r15)
98+
; LINUX-NEXT: nilf %r0, 0
99+
; LINUX-NEXT: srlg %r1, %r1, 32
100+
; LINUX-NEXT: nilf %r2, 0
101+
; LINUX-NEXT: lgdr %r3, %f0
102+
; LINUX-NEXT: srlg %r3, %r3, 32
103+
; LINUX-NEXT: lr %r0, %r1
104+
; LINUX-NEXT: lr %r2, %r3
105+
; LINUX-NEXT: stg %r2, 16(%r13)
106+
; LINUX-NEXT: stg %r0, 0(%r13)
107+
; LINUX-NEXT: ld %f8, 184(%r15) # 8-byte Reload
108+
; LINUX-NEXT: ld %f9, 176(%r15) # 8-byte Reload
109+
; LINUX-NEXT: lmg %r13, %r15, 296(%r15)
110+
; LINUX-NEXT: br %r14
111+
%result = call { <3 x float>, <3 x float> } @llvm.sincos.v3f32(<3 x float> %a)
112+
ret { <3 x float>, <3 x float> } %result
113+
}
114+
115+
define { double, double } @test_sincos_f64(double %a) #0 {
116+
; LINUX-LABEL: test_sincos_f64:
117+
; LINUX: # %bb.0:
118+
; LINUX-NEXT: stmg %r14, %r15, 112(%r15)
119+
; LINUX-NEXT: aghi %r15, -176
120+
; LINUX-NEXT: la %r2, 168(%r15)
121+
; LINUX-NEXT: la %r3, 160(%r15)
122+
; LINUX-NEXT: brasl %r14, sincos@PLT
123+
; LINUX-NEXT: ld %f0, 168(%r15)
124+
; LINUX-NEXT: ld %f2, 160(%r15)
125+
; LINUX-NEXT: lmg %r14, %r15, 288(%r15)
126+
; LINUX-NEXT: br %r14
127+
%result = call { double, double } @llvm.sincos.f64(double %a)
128+
ret { double, double } %result
129+
}
130+
131+
define { <2 x double>, <2 x double> } @test_sincos_v2f64(<2 x double> %a) #0 {
132+
; LINUX-LABEL: test_sincos_v2f64:
133+
; LINUX: # %bb.0:
134+
; LINUX-NEXT: stmg %r14, %r15, 112(%r15)
135+
; LINUX-NEXT: aghi %r15, -200
136+
; LINUX-NEXT: std %f8, 192(%r15) # 8-byte Spill
137+
; LINUX-NEXT: la %r2, 168(%r15)
138+
; LINUX-NEXT: la %r3, 160(%r15)
139+
; LINUX-NEXT: ldr %f8, %f2
140+
; LINUX-NEXT: brasl %r14, sincos@PLT
141+
; LINUX-NEXT: la %r2, 184(%r15)
142+
; LINUX-NEXT: la %r3, 176(%r15)
143+
; LINUX-NEXT: ldr %f0, %f8
144+
; LINUX-NEXT: brasl %r14, sincos@PLT
145+
; LINUX-NEXT: ld %f0, 168(%r15)
146+
; LINUX-NEXT: ld %f2, 184(%r15)
147+
; LINUX-NEXT: ld %f4, 160(%r15)
148+
; LINUX-NEXT: ld %f6, 176(%r15)
149+
; LINUX-NEXT: ld %f8, 192(%r15) # 8-byte Reload
150+
; LINUX-NEXT: lmg %r14, %r15, 312(%r15)
151+
; LINUX-NEXT: br %r14
152+
%result = call { <2 x double>, <2 x double> } @llvm.sincos.v2f64(<2 x double> %a)
153+
ret { <2 x double>, <2 x double> } %result
154+
}
155+
156+
define { fp128, fp128 } @test_sincos_f128(fp128 %a) #0 {
157+
; LINUX-LABEL: test_sincos_f128:
158+
; LINUX: # %bb.0:
159+
; LINUX-NEXT: stmg %r14, %r15, 112(%r15)
160+
; LINUX-NEXT: aghi %r15, -176
161+
; LINUX-NEXT: ld %f0, 0(%r3)
162+
; LINUX-NEXT: ld %f2, 8(%r3)
163+
; LINUX-NEXT: lgr %r3, %r2
164+
; LINUX-NEXT: la %r4, 16(%r2)
165+
; LINUX-NEXT: la %r2, 160(%r15)
166+
; LINUX-NEXT: std %f0, 160(%r15)
167+
; LINUX-NEXT: std %f2, 168(%r15)
168+
; LINUX-NEXT: brasl %r14, sincosl@PLT
169+
; LINUX-NEXT: lmg %r14, %r15, 288(%r15)
170+
; LINUX-NEXT: br %r14
171+
%result = call { fp128, fp128 } @llvm.sincos.f128(fp128 %a)
172+
ret { fp128, fp128 } %result
173+
}
174+
175+
define { <2 x fp128>, <2 x fp128> } @test_sincos_v2f128(<2 x fp128> %a) #0 {
176+
; LINUX-LABEL: test_sincos_v2f128:
177+
; LINUX: # %bb.0:
178+
; LINUX-NEXT: stmg %r13, %r15, 104(%r15)
179+
; LINUX-NEXT: aghi %r15, -208
180+
; LINUX-NEXT: std %f8, 200(%r15) # 8-byte Spill
181+
; LINUX-NEXT: std %f10, 192(%r15) # 8-byte Spill
182+
; LINUX-NEXT: lgr %r13, %r2
183+
; LINUX-NEXT: ld %f8, 0(%r3)
184+
; LINUX-NEXT: ld %f10, 8(%r3)
185+
; LINUX-NEXT: ld %f0, 16(%r3)
186+
; LINUX-NEXT: ld %f2, 24(%r3)
187+
; LINUX-NEXT: la %r3, 16(%r2)
188+
; LINUX-NEXT: la %r4, 48(%r2)
189+
; LINUX-NEXT: la %r2, 176(%r15)
190+
; LINUX-NEXT: std %f0, 176(%r15)
191+
; LINUX-NEXT: std %f2, 184(%r15)
192+
; LINUX-NEXT: brasl %r14, sincosl@PLT
193+
; LINUX-NEXT: la %r4, 32(%r13)
194+
; LINUX-NEXT: la %r2, 160(%r15)
195+
; LINUX-NEXT: std %f8, 160(%r15)
196+
; LINUX-NEXT: std %f10, 168(%r15)
197+
; LINUX-NEXT: lgr %r3, %r13
198+
; LINUX-NEXT: brasl %r14, sincosl@PLT
199+
; LINUX-NEXT: ld %f8, 200(%r15) # 8-byte Reload
200+
; LINUX-NEXT: ld %f10, 192(%r15) # 8-byte Reload
201+
; LINUX-NEXT: lmg %r13, %r15, 312(%r15)
202+
; LINUX-NEXT: br %r14
203+
%result = call { <2 x fp128>, <2 x fp128> } @llvm.sincos.v2f128(<2 x fp128> %a)
204+
ret { <2 x fp128>, <2 x fp128> } %result
205+
}
206+
207+
208+
; ZOS: .quad R(@@FSIN@B) * Offset 0 function descriptor of @@FSIN@B
209+
; ZOS: .quad V(@@FSIN@B)
210+
; ZOS: .quad R(@@FCOS@B) * Offset 16 function descriptor of @@FCOS@B
211+
; ZOS: .quad V(@@FCOS@B)
212+
; ZOS: .quad R(@@SSIN@B) * Offset 32 function descriptor of @@SSIN@B
213+
; ZOS: .quad V(@@SSIN@B)
214+
; ZOS: .quad R(@@SCOS@B) * Offset 48 function descriptor of @@SCOS@B
215+
; ZOS: .quad V(@@SCOS@B)
216+
; ZOS: .quad R(@@LSIN@B) * Offset 64 function descriptor of @@LSIN@B
217+
; ZOS: .quad V(@@LSIN@B)
218+
; ZOS: .quad R(@@LCOS@B) * Offset 80 function descriptor of @@LCOS@B
219+
; ZOS: .quad V(@@LCOS@B)
220+
221+
222+
attributes #0 = { nounwind }

0 commit comments

Comments
 (0)