[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / llvm / test / Transforms / InstSimplify / ConstProp / AMDGPU / fract.ll
blob73fc897748f6457ad66641c198eee934ec993d44
1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=instsimplify -S | FileCheck %s
4 declare half @llvm.amdgcn.fract.f16(half)
5 declare float @llvm.amdgcn.fract.f32(float)
6 declare double @llvm.amdgcn.fract.f64(double)
8 define void @test_f16(ptr %p) {
9 ; CHECK-LABEL: @test_f16(
10 ; CHECK-NEXT:    store volatile half 0xH0000, ptr [[P:%.*]]
11 ; CHECK-NEXT:    store volatile half 0xH0000, ptr [[P]]
12 ; CHECK-NEXT:    store volatile half 0xH0000, ptr [[P]]
13 ; CHECK-NEXT:    store volatile half 0xH0000, ptr [[P]]
14 ; CHECK-NEXT:    store volatile half 0xH3400, ptr [[P]]
15 ; CHECK-NEXT:    store volatile half 0xH3B00, ptr [[P]]
16 ; CHECK-NEXT:    store volatile half 0xH0400, ptr [[P]]
17 ; CHECK-NEXT:    store volatile half 0xH3BFF, ptr [[P]]
18 ; CHECK-NEXT:    store volatile half 0xH7E00, ptr [[P]]
19 ; CHECK-NEXT:    store volatile half 0xH7E00, ptr [[P]]
20 ; CHECK-NEXT:    store volatile half 0xH7E00, ptr [[P]]
21 ; CHECK-NEXT:    ret void
23   %p0 = call half @llvm.amdgcn.fract.f16(half +0.0)
24   store volatile half %p0, ptr %p
25   %n0 = call half @llvm.amdgcn.fract.f16(half -0.0)
26   store volatile half %n0, ptr %p
27   %p1 = call half @llvm.amdgcn.fract.f16(half +1.0)
28   store volatile half %p1, ptr %p
29   %n1 = call half @llvm.amdgcn.fract.f16(half -1.0)
30   store volatile half %n1, ptr %p
31   %p225 = call half @llvm.amdgcn.fract.f16(half +2.25)
32   store volatile half %p225, ptr %p
33   %n6125 = call half @llvm.amdgcn.fract.f16(half -6.125)
34   store volatile half %n6125, ptr %p
35   %ptiny = call half @llvm.amdgcn.fract.f16(half 0xH0400) ; +min normal
36   store volatile half %ptiny, ptr %p
37   %ntiny = call half @llvm.amdgcn.fract.f16(half 0xH8400) ; -min normal
38   store volatile half %ntiny, ptr %p
39   %pinf = call half @llvm.amdgcn.fract.f16(half 0xH7C00) ; +inf
40   store volatile half %pinf, ptr %p
41   %ninf = call half @llvm.amdgcn.fract.f16(half 0xHFC00) ; -inf
42   store volatile half %ninf, ptr %p
43   %nan = call half @llvm.amdgcn.fract.f16(half 0xH7E00) ; nan
44   store volatile half %nan, ptr %p
45   ret void
48 define void @test_f32(ptr %p) {
49 ; CHECK-LABEL: @test_f32(
50 ; CHECK-NEXT:    store volatile float 0.000000e+00, ptr [[P:%.*]]
51 ; CHECK-NEXT:    store volatile float 0.000000e+00, ptr [[P]]
52 ; CHECK-NEXT:    store volatile float 0.000000e+00, ptr [[P]]
53 ; CHECK-NEXT:    store volatile float 0.000000e+00, ptr [[P]]
54 ; CHECK-NEXT:    store volatile float 2.500000e-01, ptr [[P]]
55 ; CHECK-NEXT:    store volatile float 8.750000e-01, ptr [[P]]
56 ; CHECK-NEXT:    store volatile float 0x3810000000000000, ptr [[P]]
57 ; CHECK-NEXT:    store volatile float 0x3FEFFFFFE0000000, ptr [[P]]
58 ; CHECK-NEXT:    store volatile float 0x7FF8000000000000, ptr [[P]]
59 ; CHECK-NEXT:    store volatile float 0x7FF8000000000000, ptr [[P]]
60 ; CHECK-NEXT:    store volatile float 0x7FF8000000000000, ptr [[P]]
61 ; CHECK-NEXT:    ret void
63   %p0 = call float @llvm.amdgcn.fract.f32(float +0.0)
64   store volatile float %p0, ptr %p
65   %n0 = call float @llvm.amdgcn.fract.f32(float -0.0)
66   store volatile float %n0, ptr %p
67   %p1 = call float @llvm.amdgcn.fract.f32(float +1.0)
68   store volatile float %p1, ptr %p
69   %n1 = call float @llvm.amdgcn.fract.f32(float -1.0)
70   store volatile float %n1, ptr %p
71   %p225 = call float @llvm.amdgcn.fract.f32(float +2.25)
72   store volatile float %p225, ptr %p
73   %n6125 = call float @llvm.amdgcn.fract.f32(float -6.125)
74   store volatile float %n6125, ptr %p
75   %ptiny = call float @llvm.amdgcn.fract.f32(float 0x3810000000000000) ; +min normal
76   store volatile float %ptiny, ptr %p
77   %ntiny = call float @llvm.amdgcn.fract.f32(float 0xB810000000000000) ; -min normal
78   store volatile float %ntiny, ptr %p
79   %pinf = call float @llvm.amdgcn.fract.f32(float 0x7FF0000000000000) ; +inf
80   store volatile float %pinf, ptr %p
81   %ninf = call float @llvm.amdgcn.fract.f32(float 0xFFF0000000000000) ; -inf
82   store volatile float %ninf, ptr %p
83   %nan = call float @llvm.amdgcn.fract.f32(float 0x7FF8000000000000) ; nan
84   store volatile float %nan, ptr %p
85   ret void
88 define void @test_f64(ptr %p) {
89 ; CHECK-LABEL: @test_f64(
90 ; CHECK-NEXT:    store volatile double 0.000000e+00, ptr [[P:%.*]]
91 ; CHECK-NEXT:    store volatile double 0.000000e+00, ptr [[P]]
92 ; CHECK-NEXT:    store volatile double 0.000000e+00, ptr [[P]]
93 ; CHECK-NEXT:    store volatile double 0.000000e+00, ptr [[P]]
94 ; CHECK-NEXT:    store volatile double 2.500000e-01, ptr [[P]]
95 ; CHECK-NEXT:    store volatile double 8.750000e-01, ptr [[P]]
96 ; CHECK-NEXT:    store volatile double 2.000000e-308, ptr [[P]]
97 ; CHECK-NEXT:    store volatile double 0x3FEFFFFFFFFFFFFF, ptr [[P]]
98 ; CHECK-NEXT:    store volatile double 0x7FF8000000000000, ptr [[P]]
99 ; CHECK-NEXT:    store volatile double 0x7FF8000000000000, ptr [[P]]
100 ; CHECK-NEXT:    store volatile double 0x7FF8000000000000, ptr [[P]]
101 ; CHECK-NEXT:    ret void
103   %p0 = call double @llvm.amdgcn.fract.f64(double +0.0)
104   store volatile double %p0, ptr %p
105   %n0 = call double @llvm.amdgcn.fract.f64(double -0.0)
106   store volatile double %n0, ptr %p
107   %p1 = call double @llvm.amdgcn.fract.f64(double +1.0)
108   store volatile double %p1, ptr %p
109   %n1 = call double @llvm.amdgcn.fract.f64(double -1.0)
110   store volatile double %n1, ptr %p
111   %p225 = call double @llvm.amdgcn.fract.f64(double +2.25)
112   store volatile double %p225, ptr %p
113   %n6125 = call double @llvm.amdgcn.fract.f64(double -6.125)
114   store volatile double %n6125, ptr %p
115   %ptiny = call double @llvm.amdgcn.fract.f64(double +2.0e-308) ; +min normal
116   store volatile double %ptiny, ptr %p
117   %ntiny = call double @llvm.amdgcn.fract.f64(double -2.0e-308) ; -min normal
118   store volatile double %ntiny, ptr %p
119   %pinf = call double @llvm.amdgcn.fract.f64(double 0x7FF0000000000000) ; +inf
120   store volatile double %pinf, ptr %p
121   %ninf = call double @llvm.amdgcn.fract.f64(double 0xFFF0000000000000) ; -inf
122   store volatile double %ninf, ptr %p
123   %nan = call double @llvm.amdgcn.fract.f64(double 0x7FF8000000000000) ; nan
124   store volatile double %nan, ptr %p
125   ret void