xref: /aosp_15_r20/external/llvm/test/CodeGen/AMDGPU/fcanonicalize.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Workerdeclare float @llvm.canonicalize.f32(float) #0
4*9880d681SAndroid Build Coastguard Workerdeclare double @llvm.canonicalize.f64(double) #0
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Worker; GCN-LABEL: {{^}}v_test_canonicalize_var_f32:
7*9880d681SAndroid Build Coastguard Worker; GCN: v_mul_f32_e32 [[REG:v[0-9]+]], 1.0, {{v[0-9]+}}
8*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dword [[REG]]
9*9880d681SAndroid Build Coastguard Workerdefine void @v_test_canonicalize_var_f32(float addrspace(1)* %out) #1 {
10*9880d681SAndroid Build Coastguard Worker  %val = load float, float addrspace(1)* %out
11*9880d681SAndroid Build Coastguard Worker  %canonicalized = call float @llvm.canonicalize.f32(float %val)
12*9880d681SAndroid Build Coastguard Worker  store float %canonicalized, float addrspace(1)* %out
13*9880d681SAndroid Build Coastguard Worker  ret void
14*9880d681SAndroid Build Coastguard Worker}
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Worker; GCN-LABEL: {{^}}s_test_canonicalize_var_f32:
17*9880d681SAndroid Build Coastguard Worker; GCN: v_mul_f32_e64 [[REG:v[0-9]+]], 1.0, {{s[0-9]+}}
18*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dword [[REG]]
19*9880d681SAndroid Build Coastguard Workerdefine void @s_test_canonicalize_var_f32(float addrspace(1)* %out, float %val) #1 {
20*9880d681SAndroid Build Coastguard Worker  %canonicalized = call float @llvm.canonicalize.f32(float %val)
21*9880d681SAndroid Build Coastguard Worker  store float %canonicalized, float addrspace(1)* %out
22*9880d681SAndroid Build Coastguard Worker  ret void
23*9880d681SAndroid Build Coastguard Worker}
24*9880d681SAndroid Build Coastguard Worker
25*9880d681SAndroid Build Coastguard Worker; GCN-LABEL: {{^}}test_fold_canonicalize_p0_f32:
26*9880d681SAndroid Build Coastguard Worker; GCN: v_mov_b32_e32 [[REG:v[0-9]+]], 0{{$}}
27*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dword [[REG]]
28*9880d681SAndroid Build Coastguard Workerdefine void @test_fold_canonicalize_p0_f32(float addrspace(1)* %out) #1 {
29*9880d681SAndroid Build Coastguard Worker  %canonicalized = call float @llvm.canonicalize.f32(float 0.0)
30*9880d681SAndroid Build Coastguard Worker  store float %canonicalized, float addrspace(1)* %out
31*9880d681SAndroid Build Coastguard Worker  ret void
32*9880d681SAndroid Build Coastguard Worker}
33*9880d681SAndroid Build Coastguard Worker
34*9880d681SAndroid Build Coastguard Worker; GCN-LABEL: {{^}}test_fold_canonicalize_n0_f32:
35*9880d681SAndroid Build Coastguard Worker; GCN: v_bfrev_b32_e32 [[REG:v[0-9]+]], 1{{$}}
36*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dword [[REG]]
37*9880d681SAndroid Build Coastguard Workerdefine void @test_fold_canonicalize_n0_f32(float addrspace(1)* %out) #1 {
38*9880d681SAndroid Build Coastguard Worker  %canonicalized = call float @llvm.canonicalize.f32(float -0.0)
39*9880d681SAndroid Build Coastguard Worker  store float %canonicalized, float addrspace(1)* %out
40*9880d681SAndroid Build Coastguard Worker  ret void
41*9880d681SAndroid Build Coastguard Worker}
42*9880d681SAndroid Build Coastguard Worker
43*9880d681SAndroid Build Coastguard Worker; GCN-LABEL: {{^}}test_fold_canonicalize_p1_f32:
44*9880d681SAndroid Build Coastguard Worker; GCN: v_mov_b32_e32 [[REG:v[0-9]+]], 1.0{{$}}
45*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dword [[REG]]
46*9880d681SAndroid Build Coastguard Workerdefine void @test_fold_canonicalize_p1_f32(float addrspace(1)* %out) #1 {
47*9880d681SAndroid Build Coastguard Worker  %canonicalized = call float @llvm.canonicalize.f32(float 1.0)
48*9880d681SAndroid Build Coastguard Worker  store float %canonicalized, float addrspace(1)* %out
49*9880d681SAndroid Build Coastguard Worker  ret void
50*9880d681SAndroid Build Coastguard Worker}
51*9880d681SAndroid Build Coastguard Worker
52*9880d681SAndroid Build Coastguard Worker; GCN-LABEL: {{^}}test_fold_canonicalize_n1_f32:
53*9880d681SAndroid Build Coastguard Worker; GCN: v_mov_b32_e32 [[REG:v[0-9]+]], -1.0{{$}}
54*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dword [[REG]]
55*9880d681SAndroid Build Coastguard Workerdefine void @test_fold_canonicalize_n1_f32(float addrspace(1)* %out) #1 {
56*9880d681SAndroid Build Coastguard Worker  %canonicalized = call float @llvm.canonicalize.f32(float -1.0)
57*9880d681SAndroid Build Coastguard Worker  store float %canonicalized, float addrspace(1)* %out
58*9880d681SAndroid Build Coastguard Worker  ret void
59*9880d681SAndroid Build Coastguard Worker}
60*9880d681SAndroid Build Coastguard Worker
61*9880d681SAndroid Build Coastguard Worker; GCN-LABEL: {{^}}test_fold_canonicalize_literal_f32:
62*9880d681SAndroid Build Coastguard Worker; GCN: v_mov_b32_e32 [[REG:v[0-9]+]], 0x41800000{{$}}
63*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dword [[REG]]
64*9880d681SAndroid Build Coastguard Workerdefine void @test_fold_canonicalize_literal_f32(float addrspace(1)* %out) #1 {
65*9880d681SAndroid Build Coastguard Worker  %canonicalized = call float @llvm.canonicalize.f32(float 16.0)
66*9880d681SAndroid Build Coastguard Worker  store float %canonicalized, float addrspace(1)* %out
67*9880d681SAndroid Build Coastguard Worker  ret void
68*9880d681SAndroid Build Coastguard Worker}
69*9880d681SAndroid Build Coastguard Worker
70*9880d681SAndroid Build Coastguard Worker; GCN-LABEL: {{^}}test_no_denormals_fold_canonicalize_denormal0_f32:
71*9880d681SAndroid Build Coastguard Worker; GCN: v_mov_b32_e32 [[REG:v[0-9]+]], 0{{$}}
72*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dword [[REG]]
73*9880d681SAndroid Build Coastguard Workerdefine void @test_no_denormals_fold_canonicalize_denormal0_f32(float addrspace(1)* %out) #1 {
74*9880d681SAndroid Build Coastguard Worker  %canonicalized = call float @llvm.canonicalize.f32(float bitcast (i32 8388607 to float))
75*9880d681SAndroid Build Coastguard Worker  store float %canonicalized, float addrspace(1)* %out
76*9880d681SAndroid Build Coastguard Worker  ret void
77*9880d681SAndroid Build Coastguard Worker}
78*9880d681SAndroid Build Coastguard Worker
79*9880d681SAndroid Build Coastguard Worker; GCN-LABEL: {{^}}test_denormals_fold_canonicalize_denormal0_f32:
80*9880d681SAndroid Build Coastguard Worker; GCN: v_mov_b32_e32 [[REG:v[0-9]+]], 0x7fffff{{$}}
81*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dword [[REG]]
82*9880d681SAndroid Build Coastguard Workerdefine void @test_denormals_fold_canonicalize_denormal0_f32(float addrspace(1)* %out) #3 {
83*9880d681SAndroid Build Coastguard Worker  %canonicalized = call float @llvm.canonicalize.f32(float bitcast (i32 8388607 to float))
84*9880d681SAndroid Build Coastguard Worker  store float %canonicalized, float addrspace(1)* %out
85*9880d681SAndroid Build Coastguard Worker  ret void
86*9880d681SAndroid Build Coastguard Worker}
87*9880d681SAndroid Build Coastguard Worker
88*9880d681SAndroid Build Coastguard Worker; GCN-LABEL: {{^}}test_no_denormals_fold_canonicalize_denormal1_f32:
89*9880d681SAndroid Build Coastguard Worker; GCN: v_mov_b32_e32 [[REG:v[0-9]+]], 0{{$}}
90*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dword [[REG]]
91*9880d681SAndroid Build Coastguard Workerdefine void @test_no_denormals_fold_canonicalize_denormal1_f32(float addrspace(1)* %out) #1 {
92*9880d681SAndroid Build Coastguard Worker  %canonicalized = call float @llvm.canonicalize.f32(float bitcast (i32 2155872255 to float))
93*9880d681SAndroid Build Coastguard Worker  store float %canonicalized, float addrspace(1)* %out
94*9880d681SAndroid Build Coastguard Worker  ret void
95*9880d681SAndroid Build Coastguard Worker}
96*9880d681SAndroid Build Coastguard Worker
97*9880d681SAndroid Build Coastguard Worker; GCN-LABEL: {{^}}test_denormals_fold_canonicalize_denormal1_f32:
98*9880d681SAndroid Build Coastguard Worker; GCN: v_mov_b32_e32 [[REG:v[0-9]+]], 0x807fffff{{$}}
99*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dword [[REG]]
100*9880d681SAndroid Build Coastguard Workerdefine void @test_denormals_fold_canonicalize_denormal1_f32(float addrspace(1)* %out) #3 {
101*9880d681SAndroid Build Coastguard Worker  %canonicalized = call float @llvm.canonicalize.f32(float bitcast (i32 2155872255 to float))
102*9880d681SAndroid Build Coastguard Worker  store float %canonicalized, float addrspace(1)* %out
103*9880d681SAndroid Build Coastguard Worker  ret void
104*9880d681SAndroid Build Coastguard Worker}
105*9880d681SAndroid Build Coastguard Worker
106*9880d681SAndroid Build Coastguard Worker; GCN-LABEL: {{^}}test_fold_canonicalize_qnan_f32:
107*9880d681SAndroid Build Coastguard Worker; GCN: v_mov_b32_e32 [[REG:v[0-9]+]], 0x7fc00000{{$}}
108*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dword [[REG]]
109*9880d681SAndroid Build Coastguard Workerdefine void @test_fold_canonicalize_qnan_f32(float addrspace(1)* %out) #1 {
110*9880d681SAndroid Build Coastguard Worker  %canonicalized = call float @llvm.canonicalize.f32(float 0x7FF8000000000000)
111*9880d681SAndroid Build Coastguard Worker  store float %canonicalized, float addrspace(1)* %out
112*9880d681SAndroid Build Coastguard Worker  ret void
113*9880d681SAndroid Build Coastguard Worker}
114*9880d681SAndroid Build Coastguard Worker
115*9880d681SAndroid Build Coastguard Worker; GCN-LABEL: {{^}}test_fold_canonicalize_qnan_value_neg1_f32:
116*9880d681SAndroid Build Coastguard Worker; GCN: v_mov_b32_e32 [[REG:v[0-9]+]], 0x7fc00000{{$}}
117*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dword [[REG]]
118*9880d681SAndroid Build Coastguard Workerdefine void @test_fold_canonicalize_qnan_value_neg1_f32(float addrspace(1)* %out) #1 {
119*9880d681SAndroid Build Coastguard Worker  %canonicalized = call float @llvm.canonicalize.f32(float bitcast (i32 -1 to float))
120*9880d681SAndroid Build Coastguard Worker  store float %canonicalized, float addrspace(1)* %out
121*9880d681SAndroid Build Coastguard Worker  ret void
122*9880d681SAndroid Build Coastguard Worker}
123*9880d681SAndroid Build Coastguard Worker
124*9880d681SAndroid Build Coastguard Worker; GCN-LABEL: {{^}}test_fold_canonicalize_qnan_value_neg2_f32:
125*9880d681SAndroid Build Coastguard Worker; GCN: v_mov_b32_e32 [[REG:v[0-9]+]], 0x7fc00000{{$}}
126*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dword [[REG]]
127*9880d681SAndroid Build Coastguard Workerdefine void @test_fold_canonicalize_qnan_value_neg2_f32(float addrspace(1)* %out) #1 {
128*9880d681SAndroid Build Coastguard Worker  %canonicalized = call float @llvm.canonicalize.f32(float bitcast (i32 -2 to float))
129*9880d681SAndroid Build Coastguard Worker  store float %canonicalized, float addrspace(1)* %out
130*9880d681SAndroid Build Coastguard Worker  ret void
131*9880d681SAndroid Build Coastguard Worker}
132*9880d681SAndroid Build Coastguard Worker
133*9880d681SAndroid Build Coastguard Worker; GCN-LABEL: {{^}}test_fold_canonicalize_snan0_value_f32:
134*9880d681SAndroid Build Coastguard Worker; GCN: v_mov_b32_e32 [[REG:v[0-9]+]], 0x7fc00000{{$}}
135*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dword [[REG]]
136*9880d681SAndroid Build Coastguard Workerdefine void @test_fold_canonicalize_snan0_value_f32(float addrspace(1)* %out) #1 {
137*9880d681SAndroid Build Coastguard Worker  %canonicalized = call float @llvm.canonicalize.f32(float bitcast (i32 2139095041 to float))
138*9880d681SAndroid Build Coastguard Worker  store float %canonicalized, float addrspace(1)* %out
139*9880d681SAndroid Build Coastguard Worker  ret void
140*9880d681SAndroid Build Coastguard Worker}
141*9880d681SAndroid Build Coastguard Worker
142*9880d681SAndroid Build Coastguard Worker; GCN-LABEL: {{^}}test_fold_canonicalize_snan1_value_f32:
143*9880d681SAndroid Build Coastguard Worker; GCN: v_mov_b32_e32 [[REG:v[0-9]+]], 0x7fc00000{{$}}
144*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dword [[REG]]
145*9880d681SAndroid Build Coastguard Workerdefine void @test_fold_canonicalize_snan1_value_f32(float addrspace(1)* %out) #1 {
146*9880d681SAndroid Build Coastguard Worker  %canonicalized = call float @llvm.canonicalize.f32(float bitcast (i32 2143289343 to float))
147*9880d681SAndroid Build Coastguard Worker  store float %canonicalized, float addrspace(1)* %out
148*9880d681SAndroid Build Coastguard Worker  ret void
149*9880d681SAndroid Build Coastguard Worker}
150*9880d681SAndroid Build Coastguard Worker
151*9880d681SAndroid Build Coastguard Worker; GCN-LABEL: {{^}}test_fold_canonicalize_snan2_value_f32:
152*9880d681SAndroid Build Coastguard Worker; GCN: v_mov_b32_e32 [[REG:v[0-9]+]], 0x7fc00000{{$}}
153*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dword [[REG]]
154*9880d681SAndroid Build Coastguard Workerdefine void @test_fold_canonicalize_snan2_value_f32(float addrspace(1)* %out) #1 {
155*9880d681SAndroid Build Coastguard Worker  %canonicalized = call float @llvm.canonicalize.f32(float bitcast (i32 4286578689 to float))
156*9880d681SAndroid Build Coastguard Worker  store float %canonicalized, float addrspace(1)* %out
157*9880d681SAndroid Build Coastguard Worker  ret void
158*9880d681SAndroid Build Coastguard Worker}
159*9880d681SAndroid Build Coastguard Worker
160*9880d681SAndroid Build Coastguard Worker; GCN-LABEL: {{^}}test_fold_canonicalize_snan3_value_f32:
161*9880d681SAndroid Build Coastguard Worker; GCN: v_mov_b32_e32 [[REG:v[0-9]+]], 0x7fc00000{{$}}
162*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dword [[REG]]
163*9880d681SAndroid Build Coastguard Workerdefine void @test_fold_canonicalize_snan3_value_f32(float addrspace(1)* %out) #1 {
164*9880d681SAndroid Build Coastguard Worker  %canonicalized = call float @llvm.canonicalize.f32(float bitcast (i32 4290772991 to float))
165*9880d681SAndroid Build Coastguard Worker  store float %canonicalized, float addrspace(1)* %out
166*9880d681SAndroid Build Coastguard Worker  ret void
167*9880d681SAndroid Build Coastguard Worker}
168*9880d681SAndroid Build Coastguard Worker
169*9880d681SAndroid Build Coastguard Worker; GCN-LABEL: {{^}}v_test_canonicalize_var_f64:
170*9880d681SAndroid Build Coastguard Worker; GCN: v_mul_f64 [[REG:v\[[0-9]+:[0-9]+\]]], 1.0, {{v\[[0-9]+:[0-9]+\]}}
171*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dwordx2 [[REG]]
172*9880d681SAndroid Build Coastguard Workerdefine void @v_test_canonicalize_var_f64(double addrspace(1)* %out) #1 {
173*9880d681SAndroid Build Coastguard Worker  %val = load double, double addrspace(1)* %out
174*9880d681SAndroid Build Coastguard Worker  %canonicalized = call double @llvm.canonicalize.f64(double %val)
175*9880d681SAndroid Build Coastguard Worker  store double %canonicalized, double addrspace(1)* %out
176*9880d681SAndroid Build Coastguard Worker  ret void
177*9880d681SAndroid Build Coastguard Worker}
178*9880d681SAndroid Build Coastguard Worker
179*9880d681SAndroid Build Coastguard Worker; GCN-LABEL: {{^}}s_test_canonicalize_var_f64:
180*9880d681SAndroid Build Coastguard Worker; GCN: v_mul_f64 [[REG:v\[[0-9]+:[0-9]+\]]], 1.0, {{s\[[0-9]+:[0-9]+\]}}
181*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dwordx2 [[REG]]
182*9880d681SAndroid Build Coastguard Workerdefine void @s_test_canonicalize_var_f64(double addrspace(1)* %out, double %val) #1 {
183*9880d681SAndroid Build Coastguard Worker  %canonicalized = call double @llvm.canonicalize.f64(double %val)
184*9880d681SAndroid Build Coastguard Worker  store double %canonicalized, double addrspace(1)* %out
185*9880d681SAndroid Build Coastguard Worker  ret void
186*9880d681SAndroid Build Coastguard Worker}
187*9880d681SAndroid Build Coastguard Worker
188*9880d681SAndroid Build Coastguard Worker; GCN-LABEL: {{^}}test_fold_canonicalize_p0_f64:
189*9880d681SAndroid Build Coastguard Worker; GCN: v_mov_b32_e32 v[[LO:[0-9]+]], 0{{$}}
190*9880d681SAndroid Build Coastguard Worker; GCN: v_mov_b32_e32 v[[HI:[0-9]+]], v[[LO]]{{$}}
191*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dwordx2 v{{\[}}[[LO]]:[[HI]]{{\]}}
192*9880d681SAndroid Build Coastguard Workerdefine void @test_fold_canonicalize_p0_f64(double addrspace(1)* %out) #1 {
193*9880d681SAndroid Build Coastguard Worker  %canonicalized = call double @llvm.canonicalize.f64(double 0.0)
194*9880d681SAndroid Build Coastguard Worker  store double %canonicalized, double addrspace(1)* %out
195*9880d681SAndroid Build Coastguard Worker  ret void
196*9880d681SAndroid Build Coastguard Worker}
197*9880d681SAndroid Build Coastguard Worker
198*9880d681SAndroid Build Coastguard Worker; GCN-LABEL: {{^}}test_fold_canonicalize_n0_f64:
199*9880d681SAndroid Build Coastguard Worker; GCN-DAG: v_mov_b32_e32 v[[LO:[0-9]+]], 0{{$}}
200*9880d681SAndroid Build Coastguard Worker; GCN-DAG: v_bfrev_b32_e32 v[[HI:[0-9]+]], 1{{$}}
201*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dwordx2 v{{\[}}[[LO]]:[[HI]]{{\]}}
202*9880d681SAndroid Build Coastguard Workerdefine void @test_fold_canonicalize_n0_f64(double addrspace(1)* %out) #1 {
203*9880d681SAndroid Build Coastguard Worker  %canonicalized = call double @llvm.canonicalize.f64(double -0.0)
204*9880d681SAndroid Build Coastguard Worker  store double %canonicalized, double addrspace(1)* %out
205*9880d681SAndroid Build Coastguard Worker  ret void
206*9880d681SAndroid Build Coastguard Worker}
207*9880d681SAndroid Build Coastguard Worker
208*9880d681SAndroid Build Coastguard Worker; GCN-LABEL: {{^}}test_fold_canonicalize_p1_f64:
209*9880d681SAndroid Build Coastguard Worker; GCN-DAG: v_mov_b32_e32 v[[LO:[0-9]+]], 0{{$}}
210*9880d681SAndroid Build Coastguard Worker; GCN-DAG: v_mov_b32_e32 v[[HI:[0-9]+]], 0x3ff00000{{$}}
211*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dwordx2 v{{\[}}[[LO]]:[[HI]]{{\]}}
212*9880d681SAndroid Build Coastguard Workerdefine void @test_fold_canonicalize_p1_f64(double addrspace(1)* %out) #1 {
213*9880d681SAndroid Build Coastguard Worker  %canonicalized = call double @llvm.canonicalize.f64(double 1.0)
214*9880d681SAndroid Build Coastguard Worker  store double %canonicalized, double addrspace(1)* %out
215*9880d681SAndroid Build Coastguard Worker  ret void
216*9880d681SAndroid Build Coastguard Worker}
217*9880d681SAndroid Build Coastguard Worker
218*9880d681SAndroid Build Coastguard Worker; GCN-LABEL: {{^}}test_fold_canonicalize_n1_f64:
219*9880d681SAndroid Build Coastguard Worker; GCN-DAG: v_mov_b32_e32 v[[LO:[0-9]+]], 0{{$}}
220*9880d681SAndroid Build Coastguard Worker; GCN-DAG: v_mov_b32_e32 v[[HI:[0-9]+]], 0xbff00000{{$}}
221*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dwordx2 v{{\[}}[[LO]]:[[HI]]{{\]}}
222*9880d681SAndroid Build Coastguard Workerdefine void @test_fold_canonicalize_n1_f64(double addrspace(1)* %out) #1 {
223*9880d681SAndroid Build Coastguard Worker  %canonicalized = call double @llvm.canonicalize.f64(double -1.0)
224*9880d681SAndroid Build Coastguard Worker  store double %canonicalized, double addrspace(1)* %out
225*9880d681SAndroid Build Coastguard Worker  ret void
226*9880d681SAndroid Build Coastguard Worker}
227*9880d681SAndroid Build Coastguard Worker
228*9880d681SAndroid Build Coastguard Worker; GCN-LABEL: {{^}}test_fold_canonicalize_literal_f64:
229*9880d681SAndroid Build Coastguard Worker; GCN-DAG: v_mov_b32_e32 v[[LO:[0-9]+]], 0{{$}}
230*9880d681SAndroid Build Coastguard Worker; GCN-DAG: v_mov_b32_e32 v[[HI:[0-9]+]], 0x40300000{{$}}
231*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dwordx2 v{{\[}}[[LO]]:[[HI]]{{\]}}
232*9880d681SAndroid Build Coastguard Workerdefine void @test_fold_canonicalize_literal_f64(double addrspace(1)* %out) #1 {
233*9880d681SAndroid Build Coastguard Worker  %canonicalized = call double @llvm.canonicalize.f64(double 16.0)
234*9880d681SAndroid Build Coastguard Worker  store double %canonicalized, double addrspace(1)* %out
235*9880d681SAndroid Build Coastguard Worker  ret void
236*9880d681SAndroid Build Coastguard Worker}
237*9880d681SAndroid Build Coastguard Worker
238*9880d681SAndroid Build Coastguard Worker; GCN-LABEL: {{^}}test_no_denormals_fold_canonicalize_denormal0_f64:
239*9880d681SAndroid Build Coastguard Worker; GCN: v_mov_b32_e32 v[[LO:[0-9]+]], 0{{$}}
240*9880d681SAndroid Build Coastguard Worker; GCN: v_mov_b32_e32 v[[HI:[0-9]+]], v[[LO]]{{$}}
241*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dwordx2 v{{\[}}[[LO]]:[[HI]]{{\]}}
242*9880d681SAndroid Build Coastguard Workerdefine void @test_no_denormals_fold_canonicalize_denormal0_f64(double addrspace(1)* %out) #2 {
243*9880d681SAndroid Build Coastguard Worker  %canonicalized = call double @llvm.canonicalize.f64(double bitcast (i64 4503599627370495 to double))
244*9880d681SAndroid Build Coastguard Worker  store double %canonicalized, double addrspace(1)* %out
245*9880d681SAndroid Build Coastguard Worker  ret void
246*9880d681SAndroid Build Coastguard Worker}
247*9880d681SAndroid Build Coastguard Worker
248*9880d681SAndroid Build Coastguard Worker; GCN-LABEL: {{^}}test_denormals_fold_canonicalize_denormal0_f64:
249*9880d681SAndroid Build Coastguard Worker; GCN-DAG: v_mov_b32_e32 v[[LO:[0-9]+]], -1{{$}}
250*9880d681SAndroid Build Coastguard Worker; GCN-DAG: v_mov_b32_e32 v[[HI:[0-9]+]], 0xfffff{{$}}
251*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dwordx2 v{{\[}}[[LO]]:[[HI]]{{\]}}
252*9880d681SAndroid Build Coastguard Workerdefine void @test_denormals_fold_canonicalize_denormal0_f64(double addrspace(1)* %out) #3 {
253*9880d681SAndroid Build Coastguard Worker  %canonicalized = call double @llvm.canonicalize.f64(double bitcast (i64 4503599627370495 to double))
254*9880d681SAndroid Build Coastguard Worker  store double %canonicalized, double addrspace(1)* %out
255*9880d681SAndroid Build Coastguard Worker  ret void
256*9880d681SAndroid Build Coastguard Worker}
257*9880d681SAndroid Build Coastguard Worker
258*9880d681SAndroid Build Coastguard Worker; GCN-LABEL: {{^}}test_no_denormals_fold_canonicalize_denormal1_f64:
259*9880d681SAndroid Build Coastguard Worker; GCN: v_mov_b32_e32 v[[LO:[0-9]+]], 0{{$}}
260*9880d681SAndroid Build Coastguard Worker; GCN: v_mov_b32_e32 v[[HI:[0-9]+]], v[[LO]]{{$}}
261*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dwordx2 v{{\[}}[[LO]]:[[HI]]{{\]}}
262*9880d681SAndroid Build Coastguard Workerdefine void @test_no_denormals_fold_canonicalize_denormal1_f64(double addrspace(1)* %out) #2 {
263*9880d681SAndroid Build Coastguard Worker  %canonicalized = call double @llvm.canonicalize.f64(double bitcast (i64 9227875636482146303 to double))
264*9880d681SAndroid Build Coastguard Worker  store double %canonicalized, double addrspace(1)* %out
265*9880d681SAndroid Build Coastguard Worker  ret void
266*9880d681SAndroid Build Coastguard Worker}
267*9880d681SAndroid Build Coastguard Worker
268*9880d681SAndroid Build Coastguard Worker; GCN-LABEL: {{^}}test_denormals_fold_canonicalize_denormal1_f64:
269*9880d681SAndroid Build Coastguard Worker; GCN-DAG: v_mov_b32_e32 v[[LO:[0-9]+]], -1{{$}}
270*9880d681SAndroid Build Coastguard Worker; GCN-DAG: v_mov_b32_e32 v[[HI:[0-9]+]], 0x800fffff{{$}}
271*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dwordx2 v{{\[}}[[LO]]:[[HI]]{{\]}}
272*9880d681SAndroid Build Coastguard Workerdefine void @test_denormals_fold_canonicalize_denormal1_f64(double addrspace(1)* %out) #3 {
273*9880d681SAndroid Build Coastguard Worker  %canonicalized = call double @llvm.canonicalize.f64(double bitcast (i64 9227875636482146303 to double))
274*9880d681SAndroid Build Coastguard Worker  store double %canonicalized, double addrspace(1)* %out
275*9880d681SAndroid Build Coastguard Worker  ret void
276*9880d681SAndroid Build Coastguard Worker}
277*9880d681SAndroid Build Coastguard Worker
278*9880d681SAndroid Build Coastguard Worker; GCN-LABEL: {{^}}test_fold_canonicalize_qnan_f64:
279*9880d681SAndroid Build Coastguard Worker; GCN-DAG: v_mov_b32_e32 v[[HI:[0-9]+]], 0x7ff80000{{$}}
280*9880d681SAndroid Build Coastguard Worker; GCN-DAG: v_mov_b32_e32 v[[LO:[0-9]+]], 0{{$}}
281*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dwordx2 v{{\[}}[[LO]]:[[HI]]{{\]}}
282*9880d681SAndroid Build Coastguard Workerdefine void @test_fold_canonicalize_qnan_f64(double addrspace(1)* %out) #1 {
283*9880d681SAndroid Build Coastguard Worker  %canonicalized = call double @llvm.canonicalize.f64(double 0x7FF8000000000000)
284*9880d681SAndroid Build Coastguard Worker  store double %canonicalized, double addrspace(1)* %out
285*9880d681SAndroid Build Coastguard Worker  ret void
286*9880d681SAndroid Build Coastguard Worker}
287*9880d681SAndroid Build Coastguard Worker
288*9880d681SAndroid Build Coastguard Worker; GCN-LABEL: {{^}}test_fold_canonicalize_qnan_value_neg1_f64:
289*9880d681SAndroid Build Coastguard Worker; GCN-DAG: v_mov_b32_e32 v[[HI:[0-9]+]], 0x7ff80000{{$}}
290*9880d681SAndroid Build Coastguard Worker; GCN-DAG: v_mov_b32_e32 v[[LO:[0-9]+]], 0{{$}}
291*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dwordx2 v{{\[}}[[LO]]:[[HI]]{{\]}}
292*9880d681SAndroid Build Coastguard Workerdefine void @test_fold_canonicalize_qnan_value_neg1_f64(double addrspace(1)* %out) #1 {
293*9880d681SAndroid Build Coastguard Worker  %canonicalized = call double @llvm.canonicalize.f64(double bitcast (i64 -1 to double))
294*9880d681SAndroid Build Coastguard Worker  store double %canonicalized, double addrspace(1)* %out
295*9880d681SAndroid Build Coastguard Worker  ret void
296*9880d681SAndroid Build Coastguard Worker}
297*9880d681SAndroid Build Coastguard Worker
298*9880d681SAndroid Build Coastguard Worker; GCN-LABEL: {{^}}test_fold_canonicalize_qnan_value_neg2_f64:
299*9880d681SAndroid Build Coastguard Worker; GCN-DAG: v_mov_b32_e32 v[[HI:[0-9]+]], 0x7ff80000{{$}}
300*9880d681SAndroid Build Coastguard Worker; GCN-DAG: v_mov_b32_e32 v[[LO:[0-9]+]], 0{{$}}
301*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dwordx2 v{{\[}}[[LO]]:[[HI]]{{\]}}
302*9880d681SAndroid Build Coastguard Workerdefine void @test_fold_canonicalize_qnan_value_neg2_f64(double addrspace(1)* %out) #1 {
303*9880d681SAndroid Build Coastguard Worker  %canonicalized = call double @llvm.canonicalize.f64(double bitcast (i64 -2 to double))
304*9880d681SAndroid Build Coastguard Worker  store double %canonicalized, double addrspace(1)* %out
305*9880d681SAndroid Build Coastguard Worker  ret void
306*9880d681SAndroid Build Coastguard Worker}
307*9880d681SAndroid Build Coastguard Worker
308*9880d681SAndroid Build Coastguard Worker; GCN-LABEL: {{^}}test_fold_canonicalize_snan0_value_f64:
309*9880d681SAndroid Build Coastguard Worker; GCN-DAG: v_mov_b32_e32 v[[HI:[0-9]+]], 0x7ff80000{{$}}
310*9880d681SAndroid Build Coastguard Worker; GCN-DAG: v_mov_b32_e32 v[[LO:[0-9]+]], 0{{$}}
311*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dwordx2 v{{\[}}[[LO]]:[[HI]]{{\]}}
312*9880d681SAndroid Build Coastguard Workerdefine void @test_fold_canonicalize_snan0_value_f64(double addrspace(1)* %out) #1 {
313*9880d681SAndroid Build Coastguard Worker  %canonicalized = call double @llvm.canonicalize.f64(double bitcast (i64 9218868437227405313 to double))
314*9880d681SAndroid Build Coastguard Worker  store double %canonicalized, double addrspace(1)* %out
315*9880d681SAndroid Build Coastguard Worker  ret void
316*9880d681SAndroid Build Coastguard Worker}
317*9880d681SAndroid Build Coastguard Worker
318*9880d681SAndroid Build Coastguard Worker; GCN-LABEL: {{^}}test_fold_canonicalize_snan1_value_f64:
319*9880d681SAndroid Build Coastguard Worker; GCN-DAG: v_mov_b32_e32 v[[HI:[0-9]+]], 0x7ff80000{{$}}
320*9880d681SAndroid Build Coastguard Worker; GCN-DAG: v_mov_b32_e32 v[[LO:[0-9]+]], 0{{$}}
321*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dwordx2 v{{\[}}[[LO]]:[[HI]]{{\]}}
322*9880d681SAndroid Build Coastguard Workerdefine void @test_fold_canonicalize_snan1_value_f64(double addrspace(1)* %out) #1 {
323*9880d681SAndroid Build Coastguard Worker  %canonicalized = call double @llvm.canonicalize.f64(double bitcast (i64 9223372036854775807 to double))
324*9880d681SAndroid Build Coastguard Worker  store double %canonicalized, double addrspace(1)* %out
325*9880d681SAndroid Build Coastguard Worker  ret void
326*9880d681SAndroid Build Coastguard Worker}
327*9880d681SAndroid Build Coastguard Worker
328*9880d681SAndroid Build Coastguard Worker; GCN-LABEL: {{^}}test_fold_canonicalize_snan2_value_f64:
329*9880d681SAndroid Build Coastguard Worker; GCN-DAG: v_mov_b32_e32 v[[HI:[0-9]+]], 0x7ff80000{{$}}
330*9880d681SAndroid Build Coastguard Worker; GCN-DAG: v_mov_b32_e32 v[[LO:[0-9]+]], 0{{$}}
331*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dwordx2 v{{\[}}[[LO]]:[[HI]]{{\]}}
332*9880d681SAndroid Build Coastguard Workerdefine void @test_fold_canonicalize_snan2_value_f64(double addrspace(1)* %out) #1 {
333*9880d681SAndroid Build Coastguard Worker  %canonicalized = call double @llvm.canonicalize.f64(double bitcast (i64 18442240474082181121 to double))
334*9880d681SAndroid Build Coastguard Worker  store double %canonicalized, double addrspace(1)* %out
335*9880d681SAndroid Build Coastguard Worker  ret void
336*9880d681SAndroid Build Coastguard Worker}
337*9880d681SAndroid Build Coastguard Worker
338*9880d681SAndroid Build Coastguard Worker; GCN-LABEL: {{^}}test_fold_canonicalize_snan3_value_f64:
339*9880d681SAndroid Build Coastguard Worker; GCN-DAG: v_mov_b32_e32 v[[HI:[0-9]+]], 0x7ff80000{{$}}
340*9880d681SAndroid Build Coastguard Worker; GCN-DAG: v_mov_b32_e32 v[[LO:[0-9]+]], 0{{$}}
341*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dwordx2 v{{\[}}[[LO]]:[[HI]]{{\]}}
342*9880d681SAndroid Build Coastguard Workerdefine void @test_fold_canonicalize_snan3_value_f64(double addrspace(1)* %out) #1 {
343*9880d681SAndroid Build Coastguard Worker  %canonicalized = call double @llvm.canonicalize.f64(double bitcast (i64 18446744073709551615 to double))
344*9880d681SAndroid Build Coastguard Worker  store double %canonicalized, double addrspace(1)* %out
345*9880d681SAndroid Build Coastguard Worker  ret void
346*9880d681SAndroid Build Coastguard Worker}
347*9880d681SAndroid Build Coastguard Worker
348*9880d681SAndroid Build Coastguard Workerattributes #0 = { nounwind readnone }
349*9880d681SAndroid Build Coastguard Workerattributes #1 = { nounwind }
350*9880d681SAndroid Build Coastguard Workerattributes #2 = { nounwind "target-features"="-fp32-denormals,-fp64-denormals" }
351*9880d681SAndroid Build Coastguard Workerattributes #3 = { nounwind "target-features"="+fp32-denormals,+fp64-denormals" }
352