1 ; RUN: opt -instcombine -S < %s | FileCheck %s
3 ; --------------------------------------------------------------------
5 ; --------------------------------------------------------------------
7 declare float @llvm.amdgcn.rcp.f32(float) nounwind readnone
8 declare double @llvm.amdgcn.rcp.f64(double) nounwind readnone
11 ; CHECK-LABEL: @test_constant_fold_rcp_f32_1
12 ; CHECK-NEXT: ret float 1.000000e+00
13 define float @test_constant_fold_rcp_f32_1() nounwind {
14 %val = call float @llvm.amdgcn.rcp.f32(float 1.0) nounwind readnone
18 ; CHECK-LABEL: @test_constant_fold_rcp_f64_1
19 ; CHECK-NEXT: ret double 1.000000e+00
20 define double @test_constant_fold_rcp_f64_1() nounwind {
21 %val = call double @llvm.amdgcn.rcp.f64(double 1.0) nounwind readnone
25 ; CHECK-LABEL: @test_constant_fold_rcp_f32_half
26 ; CHECK-NEXT: ret float 2.000000e+00
27 define float @test_constant_fold_rcp_f32_half() nounwind {
28 %val = call float @llvm.amdgcn.rcp.f32(float 0.5) nounwind readnone
32 ; CHECK-LABEL: @test_constant_fold_rcp_f64_half
33 ; CHECK-NEXT: ret double 2.000000e+00
34 define double @test_constant_fold_rcp_f64_half() nounwind {
35 %val = call double @llvm.amdgcn.rcp.f64(double 0.5) nounwind readnone
39 ; CHECK-LABEL: @test_constant_fold_rcp_f32_43
40 ; CHECK-NEXT: call float @llvm.amdgcn.rcp.f32(float 4.300000e+01)
41 define float @test_constant_fold_rcp_f32_43() nounwind {
42 %val = call float @llvm.amdgcn.rcp.f32(float 4.300000e+01) nounwind readnone
46 ; CHECK-LABEL: @test_constant_fold_rcp_f64_43
47 ; CHECK-NEXT: call double @llvm.amdgcn.rcp.f64(double 4.300000e+01)
48 define double @test_constant_fold_rcp_f64_43() nounwind {
49 %val = call double @llvm.amdgcn.rcp.f64(double 4.300000e+01) nounwind readnone
54 ; --------------------------------------------------------------------
55 ; llvm.amdgcn.frexp.mant
56 ; --------------------------------------------------------------------
58 declare float @llvm.amdgcn.frexp.mant.f32(float) nounwind readnone
59 declare double @llvm.amdgcn.frexp.mant.f64(double) nounwind readnone
62 ; CHECK-LABEL: @test_constant_fold_frexp_mant_f32_undef(
63 ; CHECK-NEXT: ret float undef
64 define float @test_constant_fold_frexp_mant_f32_undef() nounwind {
65 %val = call float @llvm.amdgcn.frexp.mant.f32(float undef)
69 ; CHECK-LABEL: @test_constant_fold_frexp_mant_f64_undef(
70 ; CHECK-NEXT: ret double undef
71 define double @test_constant_fold_frexp_mant_f64_undef() nounwind {
72 %val = call double @llvm.amdgcn.frexp.mant.f64(double undef)
76 ; CHECK-LABEL: @test_constant_fold_frexp_mant_f32_0(
77 ; CHECK-NEXT: ret float 0.000000e+00
78 define float @test_constant_fold_frexp_mant_f32_0() nounwind {
79 %val = call float @llvm.amdgcn.frexp.mant.f32(float 0.0)
83 ; CHECK-LABEL: @test_constant_fold_frexp_mant_f64_0(
84 ; CHECK-NEXT: ret double 0.000000e+00
85 define double @test_constant_fold_frexp_mant_f64_0() nounwind {
86 %val = call double @llvm.amdgcn.frexp.mant.f64(double 0.0)
91 ; CHECK-LABEL: @test_constant_fold_frexp_mant_f32_n0(
92 ; CHECK-NEXT: ret float -0.000000e+00
93 define float @test_constant_fold_frexp_mant_f32_n0() nounwind {
94 %val = call float @llvm.amdgcn.frexp.mant.f32(float -0.0)
98 ; CHECK-LABEL: @test_constant_fold_frexp_mant_f64_n0(
99 ; CHECK-NEXT: ret double -0.000000e+00
100 define double @test_constant_fold_frexp_mant_f64_n0() nounwind {
101 %val = call double @llvm.amdgcn.frexp.mant.f64(double -0.0)
105 ; CHECK-LABEL: @test_constant_fold_frexp_mant_f32_1(
106 ; CHECK-NEXT: ret float 5.000000e-01
107 define float @test_constant_fold_frexp_mant_f32_1() nounwind {
108 %val = call float @llvm.amdgcn.frexp.mant.f32(float 1.0)
112 ; CHECK-LABEL: @test_constant_fold_frexp_mant_f64_1(
113 ; CHECK-NEXT: ret double 5.000000e-01
114 define double @test_constant_fold_frexp_mant_f64_1() nounwind {
115 %val = call double @llvm.amdgcn.frexp.mant.f64(double 1.0)
119 ; CHECK-LABEL: @test_constant_fold_frexp_mant_f32_n1(
120 ; CHECK-NEXT: ret float -5.000000e-01
121 define float @test_constant_fold_frexp_mant_f32_n1() nounwind {
122 %val = call float @llvm.amdgcn.frexp.mant.f32(float -1.0)
126 ; CHECK-LABEL: @test_constant_fold_frexp_mant_f64_n1(
127 ; CHECK-NEXT: ret double -5.000000e-01
128 define double @test_constant_fold_frexp_mant_f64_n1() nounwind {
129 %val = call double @llvm.amdgcn.frexp.mant.f64(double -1.0)
133 ; CHECK-LABEL: @test_constant_fold_frexp_mant_f32_nan(
134 ; CHECK-NEXT: ret float 0x7FF8000000000000
135 define float @test_constant_fold_frexp_mant_f32_nan() nounwind {
136 %val = call float @llvm.amdgcn.frexp.mant.f32(float 0x7FF8000000000000)
140 ; CHECK-LABEL: @test_constant_fold_frexp_mant_f64_nan(
141 ; CHECK-NEXT: ret double 0x7FF8000000000000
142 define double @test_constant_fold_frexp_mant_f64_nan() nounwind {
143 %val = call double @llvm.amdgcn.frexp.mant.f64(double 0x7FF8000000000000)
147 ; CHECK-LABEL: @test_constant_fold_frexp_mant_f32_inf(
148 ; CHECK-NEXT: ret float 0x7FF0000000000000
149 define float @test_constant_fold_frexp_mant_f32_inf() nounwind {
150 %val = call float @llvm.amdgcn.frexp.mant.f32(float 0x7FF0000000000000)
154 ; CHECK-LABEL: @test_constant_fold_frexp_mant_f64_inf(
155 ; CHECK-NEXT: ret double 0x7FF0000000000000
156 define double @test_constant_fold_frexp_mant_f64_inf() nounwind {
157 %val = call double @llvm.amdgcn.frexp.mant.f64(double 0x7FF0000000000000)
161 ; CHECK-LABEL: @test_constant_fold_frexp_mant_f32_ninf(
162 ; CHECK-NEXT: ret float 0xFFF0000000000000
163 define float @test_constant_fold_frexp_mant_f32_ninf() nounwind {
164 %val = call float @llvm.amdgcn.frexp.mant.f32(float 0xFFF0000000000000)
168 ; CHECK-LABEL: @test_constant_fold_frexp_mant_f64_ninf(
169 ; CHECK-NEXT: ret double 0xFFF0000000000000
170 define double @test_constant_fold_frexp_mant_f64_ninf() nounwind {
171 %val = call double @llvm.amdgcn.frexp.mant.f64(double 0xFFF0000000000000)
175 ; CHECK-LABEL: @test_constant_fold_frexp_mant_f32_max_num(
176 ; CHECK-NEXT: ret float 0x3FEFFFFFE0000000
177 define float @test_constant_fold_frexp_mant_f32_max_num() nounwind {
178 %val = call float @llvm.amdgcn.frexp.mant.f32(float 0x47EFFFFFE0000000)
182 ; CHECK-LABEL: @test_constant_fold_frexp_mant_f64_max_num(
183 ; CHECK-NEXT: ret double 0x3FEFFFFFFFFFFFFF
184 define double @test_constant_fold_frexp_mant_f64_max_num() nounwind {
185 %val = call double @llvm.amdgcn.frexp.mant.f64(double 0x7FEFFFFFFFFFFFFF)
189 ; CHECK-LABEL: @test_constant_fold_frexp_mant_f32_min_num(
190 ; CHECK-NEXT: ret float 5.000000e-01
191 define float @test_constant_fold_frexp_mant_f32_min_num() nounwind {
192 %val = call float @llvm.amdgcn.frexp.mant.f32(float 0x36A0000000000000)
196 ; CHECK-LABEL: @test_constant_fold_frexp_mant_f64_min_num(
197 ; CHECK-NEXT: ret double 5.000000e-01
198 define double @test_constant_fold_frexp_mant_f64_min_num() nounwind {
199 %val = call double @llvm.amdgcn.frexp.mant.f64(double 4.940656e-324)
204 ; --------------------------------------------------------------------
205 ; llvm.amdgcn.frexp.exp
206 ; --------------------------------------------------------------------
208 declare i32 @llvm.amdgcn.frexp.exp.f32(float) nounwind readnone
209 declare i32 @llvm.amdgcn.frexp.exp.f64(double) nounwind readnone
211 ; CHECK-LABEL: @test_constant_fold_frexp_exp_f32_undef(
212 ; CHECK-NEXT: ret i32 undef
213 define i32 @test_constant_fold_frexp_exp_f32_undef() nounwind {
214 %val = call i32 @llvm.amdgcn.frexp.exp.f32(float undef)
218 ; CHECK-LABEL: @test_constant_fold_frexp_exp_f64_undef(
219 ; CHECK-NEXT: ret i32 undef
220 define i32 @test_constant_fold_frexp_exp_f64_undef() nounwind {
221 %val = call i32 @llvm.amdgcn.frexp.exp.f64(double undef)
225 ; CHECK-LABEL: @test_constant_fold_frexp_exp_f32_0(
226 ; CHECK-NEXT: ret i32 0
227 define i32 @test_constant_fold_frexp_exp_f32_0() nounwind {
228 %val = call i32 @llvm.amdgcn.frexp.exp.f32(float 0.0)
232 ; CHECK-LABEL: @test_constant_fold_frexp_exp_f64_0(
233 ; CHECK-NEXT: ret i32 0
234 define i32 @test_constant_fold_frexp_exp_f64_0() nounwind {
235 %val = call i32 @llvm.amdgcn.frexp.exp.f64(double 0.0)
239 ; CHECK-LABEL: @test_constant_fold_frexp_exp_f32_n0(
240 ; CHECK-NEXT: ret i32 0
241 define i32 @test_constant_fold_frexp_exp_f32_n0() nounwind {
242 %val = call i32 @llvm.amdgcn.frexp.exp.f32(float -0.0)
246 ; CHECK-LABEL: @test_constant_fold_frexp_exp_f64_n0(
247 ; CHECK-NEXT: ret i32 0
248 define i32 @test_constant_fold_frexp_exp_f64_n0() nounwind {
249 %val = call i32 @llvm.amdgcn.frexp.exp.f64(double -0.0)
253 ; CHECK-LABEL: @test_constant_fold_frexp_exp_f32_1024(
254 ; CHECK-NEXT: ret i32 11
255 define i32 @test_constant_fold_frexp_exp_f32_1024() nounwind {
256 %val = call i32 @llvm.amdgcn.frexp.exp.f32(float 1024.0)
260 ; CHECK-LABEL: @test_constant_fold_frexp_exp_f64_1024(
261 ; CHECK-NEXT: ret i32 11
262 define i32 @test_constant_fold_frexp_exp_f64_1024() nounwind {
263 %val = call i32 @llvm.amdgcn.frexp.exp.f64(double 1024.0)
267 ; CHECK-LABEL: @test_constant_fold_frexp_exp_f32_n1024(
268 ; CHECK-NEXT: ret i32 11
269 define i32 @test_constant_fold_frexp_exp_f32_n1024() nounwind {
270 %val = call i32 @llvm.amdgcn.frexp.exp.f32(float -1024.0)
274 ; CHECK-LABEL: @test_constant_fold_frexp_exp_f64_n1024(
275 ; CHECK-NEXT: ret i32 11
276 define i32 @test_constant_fold_frexp_exp_f64_n1024() nounwind {
277 %val = call i32 @llvm.amdgcn.frexp.exp.f64(double -1024.0)
281 ; CHECK-LABEL: @test_constant_fold_frexp_exp_f32_1_1024(
282 ; CHECK-NEXT: ret i32 -9
283 define i32 @test_constant_fold_frexp_exp_f32_1_1024() nounwind {
284 %val = call i32 @llvm.amdgcn.frexp.exp.f32(float 0.0009765625)
288 ; CHECK-LABEL: @test_constant_fold_frexp_exp_f64_1_1024(
289 ; CHECK-NEXT: ret i32 -9
290 define i32 @test_constant_fold_frexp_exp_f64_1_1024() nounwind {
291 %val = call i32 @llvm.amdgcn.frexp.exp.f64(double 0.0009765625)
295 ; CHECK-LABEL: @test_constant_fold_frexp_exp_f32_nan(
296 ; CHECK-NEXT: ret i32 0
297 define i32 @test_constant_fold_frexp_exp_f32_nan() nounwind {
298 %val = call i32 @llvm.amdgcn.frexp.exp.f32(float 0x7FF8000000000000)
302 ; CHECK-LABEL: @test_constant_fold_frexp_exp_f64_nan(
303 ; CHECK-NEXT: ret i32 0
304 define i32 @test_constant_fold_frexp_exp_f64_nan() nounwind {
305 %val = call i32 @llvm.amdgcn.frexp.exp.f64(double 0x7FF8000000000000)
309 ; CHECK-LABEL: @test_constant_fold_frexp_exp_f32_inf(
310 ; CHECK-NEXT: ret i32 0
311 define i32 @test_constant_fold_frexp_exp_f32_inf() nounwind {
312 %val = call i32 @llvm.amdgcn.frexp.exp.f32(float 0x7FF0000000000000)
316 ; CHECK-LABEL: @test_constant_fold_frexp_exp_f64_inf(
317 ; CHECK-NEXT: ret i32 0
318 define i32 @test_constant_fold_frexp_exp_f64_inf() nounwind {
319 %val = call i32 @llvm.amdgcn.frexp.exp.f64(double 0x7FF0000000000000)
323 ; CHECK-LABEL: @test_constant_fold_frexp_exp_f32_ninf(
324 ; CHECK-NEXT: ret i32 0
325 define i32 @test_constant_fold_frexp_exp_f32_ninf() nounwind {
326 %val = call i32 @llvm.amdgcn.frexp.exp.f32(float 0xFFF0000000000000)
330 ; CHECK-LABEL: @test_constant_fold_frexp_exp_f64_ninf(
331 ; CHECK-NEXT: ret i32 0
332 define i32 @test_constant_fold_frexp_exp_f64_ninf() nounwind {
333 %val = call i32 @llvm.amdgcn.frexp.exp.f64(double 0xFFF0000000000000)
337 ; CHECK-LABEL: @test_constant_fold_frexp_exp_f32_max_num(
338 ; CHECK-NEXT: ret i32 128
339 define i32 @test_constant_fold_frexp_exp_f32_max_num() nounwind {
340 %val = call i32 @llvm.amdgcn.frexp.exp.f32(float 0x47EFFFFFE0000000)
344 ; CHECK-LABEL: @test_constant_fold_frexp_exp_f64_max_num(
345 ; CHECK-NEXT: ret i32 1024
346 define i32 @test_constant_fold_frexp_exp_f64_max_num() nounwind {
347 %val = call i32 @llvm.amdgcn.frexp.exp.f64(double 0x7FEFFFFFFFFFFFFF)
351 ; CHECK-LABEL: @test_constant_fold_frexp_exp_f32_min_num(
352 ; CHECK-NEXT: ret i32 -148
353 define i32 @test_constant_fold_frexp_exp_f32_min_num() nounwind {
354 %val = call i32 @llvm.amdgcn.frexp.exp.f32(float 0x36A0000000000000)
358 ; CHECK-LABEL: @test_constant_fold_frexp_exp_f64_min_num(
359 ; CHECK-NEXT: ret i32 -1073
360 define i32 @test_constant_fold_frexp_exp_f64_min_num() nounwind {
361 %val = call i32 @llvm.amdgcn.frexp.exp.f64(double 4.940656e-324)
365 ; --------------------------------------------------------------------
367 ; --------------------------------------------------------------------
369 declare i1 @llvm.amdgcn.class.f32(float, i32) nounwind readnone
370 declare i1 @llvm.amdgcn.class.f64(double, i32) nounwind readnone
372 ; CHECK-LABEL: @test_class_undef_mask_f32(
373 ; CHECK: ret i1 false
374 define i1 @test_class_undef_mask_f32(float %x) nounwind {
375 %val = call i1 @llvm.amdgcn.class.f32(float %x, i32 undef)
379 ; CHECK-LABEL: @test_class_over_max_mask_f32(
380 ; CHECK: %val = call i1 @llvm.amdgcn.class.f32(float %x, i32 1)
381 define i1 @test_class_over_max_mask_f32(float %x) nounwind {
382 %val = call i1 @llvm.amdgcn.class.f32(float %x, i32 1025)
386 ; CHECK-LABEL: @test_class_no_mask_f32(
387 ; CHECK: ret i1 false
388 define i1 @test_class_no_mask_f32(float %x) nounwind {
389 %val = call i1 @llvm.amdgcn.class.f32(float %x, i32 0)
393 ; CHECK-LABEL: @test_class_full_mask_f32(
395 define i1 @test_class_full_mask_f32(float %x) nounwind {
396 %val = call i1 @llvm.amdgcn.class.f32(float %x, i32 1023)
400 ; CHECK-LABEL: @test_class_undef_no_mask_f32(
401 ; CHECK: ret i1 false
402 define i1 @test_class_undef_no_mask_f32() nounwind {
403 %val = call i1 @llvm.amdgcn.class.f32(float undef, i32 0)
407 ; CHECK-LABEL: @test_class_undef_full_mask_f32(
409 define i1 @test_class_undef_full_mask_f32() nounwind {
410 %val = call i1 @llvm.amdgcn.class.f32(float undef, i32 1023)
414 ; CHECK-LABEL: @test_class_undef_val_f32(
415 ; CHECK: ret i1 undef
416 define i1 @test_class_undef_val_f32() nounwind {
417 %val = call i1 @llvm.amdgcn.class.f32(float undef, i32 4)
421 ; CHECK-LABEL: @test_class_undef_undef_f32(
422 ; CHECK: ret i1 undef
423 define i1 @test_class_undef_undef_f32() nounwind {
424 %val = call i1 @llvm.amdgcn.class.f32(float undef, i32 undef)
428 ; CHECK-LABEL: @test_class_var_mask_f32(
429 ; CHECK: %val = call i1 @llvm.amdgcn.class.f32(float %x, i32 %mask)
430 define i1 @test_class_var_mask_f32(float %x, i32 %mask) nounwind {
431 %val = call i1 @llvm.amdgcn.class.f32(float %x, i32 %mask)
435 ; CHECK-LABEL: @test_class_isnan_f32(
436 ; CHECK: %val = fcmp uno float %x, 0.000000e+00
437 define i1 @test_class_isnan_f32(float %x) nounwind {
438 %val = call i1 @llvm.amdgcn.class.f32(float %x, i32 3)
442 ; CHECK-LABEL: @test_constant_class_snan_test_snan_f64(
444 define i1 @test_constant_class_snan_test_snan_f64() nounwind {
445 %val = call i1 @llvm.amdgcn.class.f64(double 0x7FF0000000000001, i32 1)
449 ; CHECK-LABEL: @test_constant_class_qnan_test_qnan_f64(
451 define i1 @test_constant_class_qnan_test_qnan_f64() nounwind {
452 %val = call i1 @llvm.amdgcn.class.f64(double 0x7FF8000000000000, i32 2)
456 ; CHECK-LABEL: @test_constant_class_qnan_test_snan_f64(
457 ; CHECK: ret i1 false
458 define i1 @test_constant_class_qnan_test_snan_f64() nounwind {
459 %val = call i1 @llvm.amdgcn.class.f64(double 0x7FF8000000000000, i32 1)
463 ; CHECK-LABEL: @test_constant_class_ninf_test_ninf_f64(
465 define i1 @test_constant_class_ninf_test_ninf_f64() nounwind {
466 %val = call i1 @llvm.amdgcn.class.f64(double 0xFFF0000000000000, i32 4)
470 ; CHECK-LABEL: @test_constant_class_pinf_test_ninf_f64(
471 ; CHECK: ret i1 false
472 define i1 @test_constant_class_pinf_test_ninf_f64() nounwind {
473 %val = call i1 @llvm.amdgcn.class.f64(double 0x7FF0000000000000, i32 4)
477 ; CHECK-LABEL: @test_constant_class_qnan_test_ninf_f64(
478 ; CHECK: ret i1 false
479 define i1 @test_constant_class_qnan_test_ninf_f64() nounwind {
480 %val = call i1 @llvm.amdgcn.class.f64(double 0x7FF8000000000000, i32 4)
484 ; CHECK-LABEL: @test_constant_class_snan_test_ninf_f64(
485 ; CHECK: ret i1 false
486 define i1 @test_constant_class_snan_test_ninf_f64() nounwind {
487 %val = call i1 @llvm.amdgcn.class.f64(double 0x7FF0000000000001, i32 4)
491 ; CHECK-LABEL: @test_constant_class_nnormal_test_nnormal_f64(
493 define i1 @test_constant_class_nnormal_test_nnormal_f64() nounwind {
494 %val = call i1 @llvm.amdgcn.class.f64(double -1.0, i32 8)
498 ; CHECK-LABEL: @test_constant_class_pnormal_test_nnormal_f64(
499 ; CHECK: ret i1 false
500 define i1 @test_constant_class_pnormal_test_nnormal_f64() nounwind {
501 %val = call i1 @llvm.amdgcn.class.f64(double 1.0, i32 8)
505 ; CHECK-LABEL: @test_constant_class_nsubnormal_test_nsubnormal_f64(
507 define i1 @test_constant_class_nsubnormal_test_nsubnormal_f64() nounwind {
508 %val = call i1 @llvm.amdgcn.class.f64(double 0x800fffffffffffff, i32 16)
512 ; CHECK-LABEL: @test_constant_class_psubnormal_test_nsubnormal_f64(
513 ; CHECK: ret i1 false
514 define i1 @test_constant_class_psubnormal_test_nsubnormal_f64() nounwind {
515 %val = call i1 @llvm.amdgcn.class.f64(double 0x000fffffffffffff, i32 16)
519 ; CHECK-LABEL: @test_constant_class_nzero_test_nzero_f64(
521 define i1 @test_constant_class_nzero_test_nzero_f64() nounwind {
522 %val = call i1 @llvm.amdgcn.class.f64(double -0.0, i32 32)
526 ; CHECK-LABEL: @test_constant_class_pzero_test_nzero_f64(
527 ; CHECK: ret i1 false
528 define i1 @test_constant_class_pzero_test_nzero_f64() nounwind {
529 %val = call i1 @llvm.amdgcn.class.f64(double 0.0, i32 32)
533 ; CHECK-LABEL: @test_constant_class_pzero_test_pzero_f64(
535 define i1 @test_constant_class_pzero_test_pzero_f64() nounwind {
536 %val = call i1 @llvm.amdgcn.class.f64(double 0.0, i32 64)
540 ; CHECK-LABEL: @test_constant_class_nzero_test_pzero_f64(
541 ; CHECK: ret i1 false
542 define i1 @test_constant_class_nzero_test_pzero_f64() nounwind {
543 %val = call i1 @llvm.amdgcn.class.f64(double -0.0, i32 64)
547 ; CHECK-LABEL: @test_constant_class_psubnormal_test_psubnormal_f64(
549 define i1 @test_constant_class_psubnormal_test_psubnormal_f64() nounwind {
550 %val = call i1 @llvm.amdgcn.class.f64(double 0x000fffffffffffff, i32 128)
554 ; CHECK-LABEL: @test_constant_class_nsubnormal_test_psubnormal_f64(
555 ; CHECK: ret i1 false
556 define i1 @test_constant_class_nsubnormal_test_psubnormal_f64() nounwind {
557 %val = call i1 @llvm.amdgcn.class.f64(double 0x800fffffffffffff, i32 128)
561 ; CHECK-LABEL: @test_constant_class_pnormal_test_pnormal_f64(
563 define i1 @test_constant_class_pnormal_test_pnormal_f64() nounwind {
564 %val = call i1 @llvm.amdgcn.class.f64(double 1.0, i32 256)
568 ; CHECK-LABEL: @test_constant_class_nnormal_test_pnormal_f64(
569 ; CHECK: ret i1 false
570 define i1 @test_constant_class_nnormal_test_pnormal_f64() nounwind {
571 %val = call i1 @llvm.amdgcn.class.f64(double -1.0, i32 256)
575 ; CHECK-LABEL: @test_constant_class_pinf_test_pinf_f64(
577 define i1 @test_constant_class_pinf_test_pinf_f64() nounwind {
578 %val = call i1 @llvm.amdgcn.class.f64(double 0x7FF0000000000000, i32 512)
582 ; CHECK-LABEL: @test_constant_class_ninf_test_pinf_f64(
583 ; CHECK: ret i1 false
584 define i1 @test_constant_class_ninf_test_pinf_f64() nounwind {
585 %val = call i1 @llvm.amdgcn.class.f64(double 0xFFF0000000000000, i32 512)
589 ; CHECK-LABEL: @test_constant_class_qnan_test_pinf_f64(
590 ; CHECK: ret i1 false
591 define i1 @test_constant_class_qnan_test_pinf_f64() nounwind {
592 %val = call i1 @llvm.amdgcn.class.f64(double 0x7FF8000000000000, i32 512)
596 ; CHECK-LABEL: @test_constant_class_snan_test_pinf_f64(
597 ; CHECK: ret i1 false
598 define i1 @test_constant_class_snan_test_pinf_f64() nounwind {
599 %val = call i1 @llvm.amdgcn.class.f64(double 0x7FF0000000000001, i32 512)
603 ; --------------------------------------------------------------------
605 ; --------------------------------------------------------------------
606 declare float @llvm.amdgcn.cos.f32(float) nounwind readnone
607 declare float @llvm.fabs.f32(float) nounwind readnone
609 ; CHECK-LABEL: @cos_fneg_f32(
610 ; CHECK: %cos = call float @llvm.amdgcn.cos.f32(float %x)
611 ; CHECK-NEXT: ret float %cos
612 define float @cos_fneg_f32(float %x) {
613 %x.fneg = fsub float -0.0, %x
614 %cos = call float @llvm.amdgcn.cos.f32(float %x.fneg)
618 ; CHECK-LABEL: @cos_fabs_f32(
619 ; CHECK-NEXT: %cos = call float @llvm.amdgcn.cos.f32(float %x)
620 ; CHECK-NEXT: ret float %cos
621 define float @cos_fabs_f32(float %x) {
622 %x.fabs = call float @llvm.fabs.f32(float %x)
623 %cos = call float @llvm.amdgcn.cos.f32(float %x.fabs)
627 ; CHECK-LABEL: @cos_fabs_fneg_f32(
628 ; CHECK-NEXT: %cos = call float @llvm.amdgcn.cos.f32(float %x)
629 ; CHECK-NEXT: ret float %cos
630 define float @cos_fabs_fneg_f32(float %x) {
631 %x.fabs = call float @llvm.fabs.f32(float %x)
632 %x.fabs.fneg = fsub float -0.0, %x.fabs
633 %cos = call float @llvm.amdgcn.cos.f32(float %x.fabs.fneg)