1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr8 < %s \
3 ; RUN: -verify-machineinstrs | FileCheck %s --check-prefix=P8
4 ; RUN: llc -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr9 < %s \
5 ; RUN: -verify-machineinstrs | FileCheck %s --check-prefix=P9
7 define zeroext i1 @abs_isinff(float %x) {
8 ; P8-LABEL: abs_isinff:
9 ; P8: # %bb.0: # %entry
10 ; P8-NEXT: addis 3, 2, .LCPI0_0@toc@ha
11 ; P8-NEXT: xsabsdp 0, 1
13 ; P8-NEXT: lfs 1, .LCPI0_0@toc@l(3)
15 ; P8-NEXT: fcmpu 0, 0, 1
16 ; P8-NEXT: iseleq 3, 4, 3
19 ; P9-LABEL: abs_isinff:
20 ; P9: # %bb.0: # %entry
21 ; P9-NEXT: xststdcsp 0, 1, 48
24 ; P9-NEXT: iseleq 3, 4, 3
27 %0 = tail call float @llvm.fabs.f32(float %x)
28 %cmpinf = fcmp oeq float %0, 0x7FF0000000000000
32 define zeroext i1 @abs_isinf(double %x) {
33 ; P8-LABEL: abs_isinf:
34 ; P8: # %bb.0: # %entry
35 ; P8-NEXT: addis 3, 2, .LCPI1_0@toc@ha
36 ; P8-NEXT: xsabsdp 0, 1
38 ; P8-NEXT: lfs 1, .LCPI1_0@toc@l(3)
40 ; P8-NEXT: fcmpu 0, 0, 1
41 ; P8-NEXT: iseleq 3, 4, 3
44 ; P9-LABEL: abs_isinf:
45 ; P9: # %bb.0: # %entry
46 ; P9-NEXT: xststdcdp 0, 1, 48
49 ; P9-NEXT: iseleq 3, 4, 3
52 %0 = tail call double @llvm.fabs.f64(double %x)
53 %cmpinf = fcmp oeq double %0, 0x7FF0000000000000
57 define zeroext i1 @abs_isinfq(fp128 %x) {
58 ; P8-LABEL: abs_isinfq:
59 ; P8: # %bb.0: # %entry
61 ; P8-NEXT: stdu 1, -48(1)
62 ; P8-NEXT: std 0, 64(1)
63 ; P8-NEXT: .cfi_def_cfa_offset 48
64 ; P8-NEXT: .cfi_offset lr, 16
65 ; P8-NEXT: xxswapd 0, 34
66 ; P8-NEXT: addi 3, 1, 32
67 ; P8-NEXT: stxvd2x 0, 0, 3
68 ; P8-NEXT: lbz 4, 47(1)
69 ; P8-NEXT: clrlwi 4, 4, 25
70 ; P8-NEXT: stb 4, 47(1)
71 ; P8-NEXT: lxvd2x 0, 0, 3
72 ; P8-NEXT: addis 3, 2, .LCPI2_0@toc@ha
73 ; P8-NEXT: addi 3, 3, .LCPI2_0@toc@l
74 ; P8-NEXT: xxswapd 34, 0
75 ; P8-NEXT: lxvd2x 0, 0, 3
76 ; P8-NEXT: xxswapd 35, 0
79 ; P8-NEXT: cntlzw 3, 3
80 ; P8-NEXT: srwi 3, 3, 5
81 ; P8-NEXT: addi 1, 1, 48
82 ; P8-NEXT: ld 0, 16(1)
86 ; P9-LABEL: abs_isinfq:
87 ; P9: # %bb.0: # %entry
88 ; P9-NEXT: xststdcqp 0, 2, 48
91 ; P9-NEXT: iseleq 3, 4, 3
94 %0 = tail call fp128 @llvm.fabs.f128(fp128 %x)
95 %cmpinf = fcmp oeq fp128 %0, 0xL00000000000000007FFF000000000000
99 define zeroext i1 @abs_isinfornanf(float %x) {
100 ; P8-LABEL: abs_isinfornanf:
101 ; P8: # %bb.0: # %entry
102 ; P8-NEXT: addis 3, 2, .LCPI3_0@toc@ha
103 ; P8-NEXT: xsabsdp 0, 1
104 ; P8-NEXT: lfs 1, .LCPI3_0@toc@l(3)
106 ; P8-NEXT: fcmpu 0, 0, 1
107 ; P8-NEXT: isellt 3, 0, 3
110 ; P9-LABEL: abs_isinfornanf:
111 ; P9: # %bb.0: # %entry
112 ; P9-NEXT: xststdcsp 0, 1, 112
115 ; P9-NEXT: iseleq 3, 4, 3
118 %0 = tail call float @llvm.fabs.f32(float %x)
119 %cmpinf = fcmp ueq float %0, 0x7FF0000000000000
123 define zeroext i1 @abs_isinfornan(double %x) {
124 ; P8-LABEL: abs_isinfornan:
125 ; P8: # %bb.0: # %entry
126 ; P8-NEXT: addis 3, 2, .LCPI4_0@toc@ha
127 ; P8-NEXT: xsabsdp 0, 1
128 ; P8-NEXT: lfs 1, .LCPI4_0@toc@l(3)
130 ; P8-NEXT: fcmpu 0, 0, 1
131 ; P8-NEXT: isellt 3, 0, 3
134 ; P9-LABEL: abs_isinfornan:
135 ; P9: # %bb.0: # %entry
136 ; P9-NEXT: xststdcdp 0, 1, 112
139 ; P9-NEXT: iseleq 3, 4, 3
142 %0 = tail call double @llvm.fabs.f64(double %x)
143 %cmpinf = fcmp ueq double %0, 0x7FF0000000000000
147 define zeroext i1 @abs_isinfornanq(fp128 %x) {
148 ; P8-LABEL: abs_isinfornanq:
149 ; P8: # %bb.0: # %entry
151 ; P8-NEXT: stdu 1, -112(1)
152 ; P8-NEXT: std 0, 128(1)
153 ; P8-NEXT: .cfi_def_cfa_offset 112
154 ; P8-NEXT: .cfi_offset lr, 16
155 ; P8-NEXT: .cfi_offset r30, -16
156 ; P8-NEXT: .cfi_offset v30, -48
157 ; P8-NEXT: .cfi_offset v31, -32
159 ; P8-NEXT: xxswapd 0, 34
160 ; P8-NEXT: std 30, 96(1) # 8-byte Folded Spill
161 ; P8-NEXT: stvx 30, 1, 3 # 16-byte Folded Spill
163 ; P8-NEXT: stvx 31, 1, 3 # 16-byte Folded Spill
164 ; P8-NEXT: addi 3, 1, 48
165 ; P8-NEXT: stxvd2x 0, 0, 3
166 ; P8-NEXT: lbz 4, 63(1)
167 ; P8-NEXT: clrlwi 4, 4, 25
168 ; P8-NEXT: stb 4, 63(1)
169 ; P8-NEXT: lxvd2x 0, 0, 3
170 ; P8-NEXT: addis 3, 2, .LCPI5_0@toc@ha
171 ; P8-NEXT: addi 3, 3, .LCPI5_0@toc@l
172 ; P8-NEXT: xxswapd 63, 0
173 ; P8-NEXT: lxvd2x 0, 0, 3
175 ; P8-NEXT: xxswapd 62, 0
177 ; P8-NEXT: bl __eqkf2
179 ; P8-NEXT: cntlzw 3, 3
182 ; P8-NEXT: srwi 30, 3, 5
183 ; P8-NEXT: bl __unordkf2
185 ; P8-NEXT: cntlzw 3, 3
187 ; P8-NEXT: lvx 31, 1, 4 # 16-byte Folded Reload
189 ; P8-NEXT: srwi 3, 3, 5
190 ; P8-NEXT: lvx 30, 1, 4 # 16-byte Folded Reload
191 ; P8-NEXT: xori 3, 3, 1
192 ; P8-NEXT: or 3, 3, 30
193 ; P8-NEXT: ld 30, 96(1) # 8-byte Folded Reload
194 ; P8-NEXT: addi 1, 1, 112
195 ; P8-NEXT: ld 0, 16(1)
199 ; P9-LABEL: abs_isinfornanq:
200 ; P9: # %bb.0: # %entry
201 ; P9-NEXT: xststdcqp 0, 2, 112
204 ; P9-NEXT: iseleq 3, 4, 3
207 %0 = tail call fp128 @llvm.fabs.f128(fp128 %x)
208 %cmpinf = fcmp ueq fp128 %0, 0xL00000000000000007FFF000000000000
212 define <4 x i1> @abs_isinfv4f32(<4 x float> %x) {
213 ; P8-LABEL: abs_isinfv4f32:
214 ; P8: # %bb.0: # %entry
215 ; P8-NEXT: addis 3, 2, .LCPI6_0@toc@ha
216 ; P8-NEXT: xvabssp 0, 34
217 ; P8-NEXT: addi 3, 3, .LCPI6_0@toc@l
218 ; P8-NEXT: lxvd2x 1, 0, 3
219 ; P8-NEXT: xvcmpeqsp 34, 0, 1
222 ; P9-LABEL: abs_isinfv4f32:
223 ; P9: # %bb.0: # %entry
224 ; P9-NEXT: addis 3, 2, .LCPI6_0@toc@ha
225 ; P9-NEXT: xvabssp 0, 34
226 ; P9-NEXT: addi 3, 3, .LCPI6_0@toc@l
227 ; P9-NEXT: lxv 1, 0(3)
228 ; P9-NEXT: xvcmpeqsp 34, 0, 1
231 %0 = tail call <4 x float> @llvm.fabs.v4f32(<4 x float> %x)
232 %cmpinf = fcmp oeq <4 x float> %0, <float 0x7FF0000000000000, float 0x7FF0000000000000, float 0x7FF0000000000000, float 0x7FF0000000000000>
236 define <2 x i1> @abs_isinfv2f64(<2 x double> %x) {
237 ; P8-LABEL: abs_isinfv2f64:
238 ; P8: # %bb.0: # %entry
239 ; P8-NEXT: addis 3, 2, .LCPI7_0@toc@ha
240 ; P8-NEXT: xvabsdp 0, 34
241 ; P8-NEXT: addi 3, 3, .LCPI7_0@toc@l
242 ; P8-NEXT: lxvd2x 1, 0, 3
243 ; P8-NEXT: xvcmpeqdp 34, 0, 1
246 ; P9-LABEL: abs_isinfv2f64:
247 ; P9: # %bb.0: # %entry
248 ; P9-NEXT: addis 3, 2, .LCPI7_0@toc@ha
249 ; P9-NEXT: xvabsdp 0, 34
250 ; P9-NEXT: addi 3, 3, .LCPI7_0@toc@l
251 ; P9-NEXT: lxv 1, 0(3)
252 ; P9-NEXT: xvcmpeqdp 34, 0, 1
255 %0 = tail call <2 x double> @llvm.fabs.v2f64(<2 x double> %x)
256 %cmpinf = fcmp oeq <2 x double> %0, <double 0x7FF0000000000000, double 0x7FF0000000000000>
260 define zeroext i1 @iszerof(float %x) {
262 ; P8: # %bb.0: # %entry
263 ; P8-NEXT: xxlxor 0, 0, 0
266 ; P8-NEXT: fcmpu 0, 1, 0
267 ; P8-NEXT: iseleq 3, 4, 3
271 ; P9: # %bb.0: # %entry
272 ; P9-NEXT: xxlxor 0, 0, 0
275 ; P9-NEXT: fcmpu 0, 1, 0
276 ; P9-NEXT: iseleq 3, 4, 3
279 %cmp = fcmp oeq float %x, 0.000000e+00
283 define zeroext i1 @iszero(double %x) {
285 ; P8: # %bb.0: # %entry
286 ; P8-NEXT: xxlxor 0, 0, 0
289 ; P8-NEXT: fcmpu 0, 1, 0
290 ; P8-NEXT: iseleq 3, 4, 3
294 ; P9: # %bb.0: # %entry
295 ; P9-NEXT: xxlxor 0, 0, 0
298 ; P9-NEXT: fcmpu 0, 1, 0
299 ; P9-NEXT: iseleq 3, 4, 3
302 %cmp = fcmp oeq double %x, 0.000000e+00
306 define zeroext i1 @iszeroq(fp128 %x) {
308 ; P8: # %bb.0: # %entry
310 ; P8-NEXT: stdu 1, -32(1)
311 ; P8-NEXT: std 0, 48(1)
312 ; P8-NEXT: .cfi_def_cfa_offset 32
313 ; P8-NEXT: .cfi_offset lr, 16
314 ; P8-NEXT: addis 3, 2, .LCPI10_0@toc@ha
315 ; P8-NEXT: addi 3, 3, .LCPI10_0@toc@l
316 ; P8-NEXT: lxvd2x 0, 0, 3
317 ; P8-NEXT: xxswapd 35, 0
318 ; P8-NEXT: bl __eqkf2
320 ; P8-NEXT: cntlzw 3, 3
321 ; P8-NEXT: srwi 3, 3, 5
322 ; P8-NEXT: addi 1, 1, 32
323 ; P8-NEXT: ld 0, 16(1)
328 ; P9: # %bb.0: # %entry
329 ; P9-NEXT: addis 3, 2, .LCPI10_0@toc@ha
331 ; P9-NEXT: addi 3, 3, .LCPI10_0@toc@l
332 ; P9-NEXT: lxv 35, 0(3)
334 ; P9-NEXT: xscmpuqp 0, 2, 3
335 ; P9-NEXT: iseleq 3, 4, 3
338 %cmp = fcmp oeq fp128 %x, 0xL00000000000000000000000000000000
342 define <4 x i1> @iszerov4f32(<4 x float> %x) {
343 ; P8-LABEL: iszerov4f32:
344 ; P8: # %bb.0: # %entry
345 ; P8-NEXT: xxlxor 0, 0, 0
346 ; P8-NEXT: xvcmpeqsp 34, 34, 0
349 ; P9-LABEL: iszerov4f32:
350 ; P9: # %bb.0: # %entry
351 ; P9-NEXT: xxlxor 0, 0, 0
352 ; P9-NEXT: xvcmpeqsp 34, 34, 0
355 %cmp = fcmp oeq <4 x float> %x, <float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00>
359 define <2 x i1> @iszerov2f64(<2 x double> %x) {
360 ; P8-LABEL: iszerov2f64:
361 ; P8: # %bb.0: # %entry
362 ; P8-NEXT: xxlxor 0, 0, 0
363 ; P8-NEXT: xvcmpeqdp 34, 34, 0
366 ; P9-LABEL: iszerov2f64:
367 ; P9: # %bb.0: # %entry
368 ; P9-NEXT: xxlxor 0, 0, 0
369 ; P9-NEXT: xvcmpeqdp 34, 34, 0
372 %cmp = fcmp oeq <2 x double> %x, <double 0.000000e+00, double 0.000000e+00>
376 declare float @llvm.fabs.f32(float)
377 declare double @llvm.fabs.f64(double)
378 declare fp128 @llvm.fabs.f128(fp128)
379 declare <4 x float> @llvm.fabs.v4f32(<4 x float>)
380 declare <2 x double> @llvm.fabs.v2f64(<2 x double>)