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
60 ; P8-NEXT: xxswapd 0, 34
61 ; P8-NEXT: addi 3, 1, -16
62 ; P8-NEXT: li 5, 32767
63 ; P8-NEXT: stxvd2x 0, 0, 3
64 ; P8-NEXT: rldic 5, 5, 48, 1
65 ; P8-NEXT: ld 4, -8(1)
66 ; P8-NEXT: ld 3, -16(1)
67 ; P8-NEXT: clrldi 4, 4, 1
68 ; P8-NEXT: xor 4, 4, 5
70 ; P8-NEXT: cntlzd 3, 3
71 ; P8-NEXT: rldicl 3, 3, 58, 63
74 ; P9-LABEL: abs_isinfq:
75 ; P9: # %bb.0: # %entry
76 ; P9-NEXT: xststdcqp 0, 2, 48
79 ; P9-NEXT: iseleq 3, 4, 3
82 %0 = tail call fp128 @llvm.fabs.f128(fp128 %x)
83 %cmpinf = fcmp oeq fp128 %0, 0xL00000000000000007FFF000000000000
87 define zeroext i1 @abs_isinfornanf(float %x) {
88 ; P8-LABEL: abs_isinfornanf:
89 ; P8: # %bb.0: # %entry
90 ; P8-NEXT: xscvdpspn 0, 1
91 ; P8-NEXT: lis 4, 32639
92 ; P8-NEXT: ori 4, 4, 65535
93 ; P8-NEXT: mffprwz 3, 0
94 ; P8-NEXT: clrlwi 3, 3, 1
95 ; P8-NEXT: sub 3, 4, 3
96 ; P8-NEXT: rldicl 3, 3, 1, 63
99 ; P9-LABEL: abs_isinfornanf:
100 ; P9: # %bb.0: # %entry
101 ; P9-NEXT: xststdcsp 0, 1, 112
104 ; P9-NEXT: iseleq 3, 4, 3
107 %0 = tail call float @llvm.fabs.f32(float %x)
108 %cmpinf = fcmp ueq float %0, 0x7FF0000000000000
112 define zeroext i1 @abs_isinfornan(double %x) {
113 ; P8-LABEL: abs_isinfornan:
114 ; P8: # %bb.0: # %entry
115 ; P8-NEXT: mffprd 3, 1
117 ; P8-NEXT: rldicl 4, 4, 47, 1
118 ; P8-NEXT: sradi 5, 4, 63
119 ; P8-NEXT: clrldi 3, 3, 1
120 ; P8-NEXT: rldicl 6, 3, 1, 63
121 ; P8-NEXT: subc 3, 4, 3
122 ; P8-NEXT: adde 3, 6, 5
123 ; P8-NEXT: xori 3, 3, 1
126 ; P9-LABEL: abs_isinfornan:
127 ; P9: # %bb.0: # %entry
128 ; P9-NEXT: xststdcdp 0, 1, 112
131 ; P9-NEXT: iseleq 3, 4, 3
134 %0 = tail call double @llvm.fabs.f64(double %x)
135 %cmpinf = fcmp ueq double %0, 0x7FF0000000000000
139 define zeroext i1 @abs_isinfornanq(fp128 %x) {
140 ; P8-LABEL: abs_isinfornanq:
141 ; P8: # %bb.0: # %entry
142 ; P8-NEXT: xxswapd 0, 34
143 ; P8-NEXT: addi 3, 1, -16
145 ; P8-NEXT: stxvd2x 0, 0, 3
146 ; P8-NEXT: rldicl 4, 4, 47, 1
147 ; P8-NEXT: ld 3, -8(1)
148 ; P8-NEXT: sradi 5, 4, 63
149 ; P8-NEXT: clrldi 3, 3, 1
150 ; P8-NEXT: rldicl 6, 3, 1, 63
151 ; P8-NEXT: subc 3, 4, 3
152 ; P8-NEXT: adde 3, 6, 5
153 ; P8-NEXT: xori 3, 3, 1
156 ; P9-LABEL: abs_isinfornanq:
157 ; P9: # %bb.0: # %entry
158 ; P9-NEXT: xststdcqp 0, 2, 112
161 ; P9-NEXT: iseleq 3, 4, 3
164 %0 = tail call fp128 @llvm.fabs.f128(fp128 %x)
165 %cmpinf = fcmp ueq fp128 %0, 0xL00000000000000007FFF000000000000
169 define <4 x i1> @abs_isinfv4f32(<4 x float> %x) {
170 ; P8-LABEL: abs_isinfv4f32:
171 ; P8: # %bb.0: # %entry
172 ; P8-NEXT: addis 3, 2, .LCPI6_0@toc@ha
173 ; P8-NEXT: xvabssp 0, 34
174 ; P8-NEXT: addi 3, 3, .LCPI6_0@toc@l
175 ; P8-NEXT: lxvd2x 1, 0, 3
176 ; P8-NEXT: xvcmpeqsp 34, 0, 1
179 ; P9-LABEL: abs_isinfv4f32:
180 ; P9: # %bb.0: # %entry
181 ; P9-NEXT: addis 3, 2, .LCPI6_0@toc@ha
182 ; P9-NEXT: xvabssp 0, 34
183 ; P9-NEXT: addi 3, 3, .LCPI6_0@toc@l
184 ; P9-NEXT: lxv 1, 0(3)
185 ; P9-NEXT: xvcmpeqsp 34, 0, 1
188 %0 = tail call <4 x float> @llvm.fabs.v4f32(<4 x float> %x)
189 %cmpinf = fcmp oeq <4 x float> %0, <float 0x7FF0000000000000, float 0x7FF0000000000000, float 0x7FF0000000000000, float 0x7FF0000000000000>
193 define <2 x i1> @abs_isinfv2f64(<2 x double> %x) {
194 ; P8-LABEL: abs_isinfv2f64:
195 ; P8: # %bb.0: # %entry
196 ; P8-NEXT: addis 3, 2, .LCPI7_0@toc@ha
197 ; P8-NEXT: xvabsdp 0, 34
198 ; P8-NEXT: addi 3, 3, .LCPI7_0@toc@l
199 ; P8-NEXT: lxvd2x 1, 0, 3
200 ; P8-NEXT: xvcmpeqdp 34, 0, 1
203 ; P9-LABEL: abs_isinfv2f64:
204 ; P9: # %bb.0: # %entry
205 ; P9-NEXT: addis 3, 2, .LCPI7_0@toc@ha
206 ; P9-NEXT: xvabsdp 0, 34
207 ; P9-NEXT: addi 3, 3, .LCPI7_0@toc@l
208 ; P9-NEXT: lxv 1, 0(3)
209 ; P9-NEXT: xvcmpeqdp 34, 0, 1
212 %0 = tail call <2 x double> @llvm.fabs.v2f64(<2 x double> %x)
213 %cmpinf = fcmp oeq <2 x double> %0, <double 0x7FF0000000000000, double 0x7FF0000000000000>
217 define zeroext i1 @iszerof(float %x) {
219 ; P8: # %bb.0: # %entry
220 ; P8-NEXT: xxlxor 0, 0, 0
223 ; P8-NEXT: fcmpu 0, 1, 0
224 ; P8-NEXT: iseleq 3, 4, 3
228 ; P9: # %bb.0: # %entry
229 ; P9-NEXT: xxlxor 0, 0, 0
232 ; P9-NEXT: fcmpu 0, 1, 0
233 ; P9-NEXT: iseleq 3, 4, 3
236 %cmp = fcmp oeq float %x, 0.000000e+00
240 define zeroext i1 @iszero(double %x) {
242 ; P8: # %bb.0: # %entry
243 ; P8-NEXT: xxlxor 0, 0, 0
246 ; P8-NEXT: fcmpu 0, 1, 0
247 ; P8-NEXT: iseleq 3, 4, 3
251 ; P9: # %bb.0: # %entry
252 ; P9-NEXT: xxlxor 0, 0, 0
255 ; P9-NEXT: fcmpu 0, 1, 0
256 ; P9-NEXT: iseleq 3, 4, 3
259 %cmp = fcmp oeq double %x, 0.000000e+00
263 define zeroext i1 @iszeroq(fp128 %x) {
265 ; P8: # %bb.0: # %entry
267 ; P8-NEXT: stdu 1, -32(1)
268 ; P8-NEXT: std 0, 48(1)
269 ; P8-NEXT: .cfi_def_cfa_offset 32
270 ; P8-NEXT: .cfi_offset lr, 16
271 ; P8-NEXT: addis 3, 2, .LCPI10_0@toc@ha
272 ; P8-NEXT: addi 3, 3, .LCPI10_0@toc@l
273 ; P8-NEXT: lxvd2x 0, 0, 3
274 ; P8-NEXT: xxswapd 35, 0
275 ; P8-NEXT: bl __eqkf2
277 ; P8-NEXT: cntlzw 3, 3
278 ; P8-NEXT: srwi 3, 3, 5
279 ; P8-NEXT: addi 1, 1, 32
280 ; P8-NEXT: ld 0, 16(1)
285 ; P9: # %bb.0: # %entry
286 ; P9-NEXT: addis 3, 2, .LCPI10_0@toc@ha
288 ; P9-NEXT: addi 3, 3, .LCPI10_0@toc@l
289 ; P9-NEXT: lxv 35, 0(3)
291 ; P9-NEXT: xscmpuqp 0, 2, 3
292 ; P9-NEXT: iseleq 3, 4, 3
295 %cmp = fcmp oeq fp128 %x, 0xL00000000000000000000000000000000
299 define <4 x i1> @iszerov4f32(<4 x float> %x) {
300 ; P8-LABEL: iszerov4f32:
301 ; P8: # %bb.0: # %entry
302 ; P8-NEXT: xxlxor 0, 0, 0
303 ; P8-NEXT: xvcmpeqsp 34, 34, 0
306 ; P9-LABEL: iszerov4f32:
307 ; P9: # %bb.0: # %entry
308 ; P9-NEXT: xxlxor 0, 0, 0
309 ; P9-NEXT: xvcmpeqsp 34, 34, 0
312 %cmp = fcmp oeq <4 x float> %x, <float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00>
316 define <2 x i1> @iszerov2f64(<2 x double> %x) {
317 ; P8-LABEL: iszerov2f64:
318 ; P8: # %bb.0: # %entry
319 ; P8-NEXT: xxlxor 0, 0, 0
320 ; P8-NEXT: xvcmpeqdp 34, 34, 0
323 ; P9-LABEL: iszerov2f64:
324 ; P9: # %bb.0: # %entry
325 ; P9-NEXT: xxlxor 0, 0, 0
326 ; P9-NEXT: xvcmpeqdp 34, 34, 0
329 %cmp = fcmp oeq <2 x double> %x, <double 0.000000e+00, double 0.000000e+00>
333 declare float @llvm.fabs.f32(float)
334 declare double @llvm.fabs.f64(double)
335 declare fp128 @llvm.fabs.f128(fp128)
336 declare <4 x float> @llvm.fabs.v4f32(<4 x float>)
337 declare <2 x double> @llvm.fabs.v2f64(<2 x double>)