xref: /aosp_15_r20/external/llvm/test/Transforms/InstCombine/amdgcn-intrinsics.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: opt -instcombine -S < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker; --------------------------------------------------------------------
4*9880d681SAndroid Build Coastguard Worker; llvm.amdgcn.rcp
5*9880d681SAndroid Build Coastguard Worker; --------------------------------------------------------------------
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Workerdeclare float @llvm.amdgcn.rcp.f32(float) nounwind readnone
8*9880d681SAndroid Build Coastguard Workerdeclare double @llvm.amdgcn.rcp.f64(double) nounwind readnone
9*9880d681SAndroid Build Coastguard Worker
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_rcp_f32_1
12*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret float 1.000000e+00
13*9880d681SAndroid Build Coastguard Workerdefine float @test_constant_fold_rcp_f32_1() nounwind {
14*9880d681SAndroid Build Coastguard Worker  %val = call float @llvm.amdgcn.rcp.f32(float 1.0) nounwind readnone
15*9880d681SAndroid Build Coastguard Worker  ret float %val
16*9880d681SAndroid Build Coastguard Worker}
17*9880d681SAndroid Build Coastguard Worker
18*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_rcp_f64_1
19*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  ret double 1.000000e+00
20*9880d681SAndroid Build Coastguard Workerdefine double @test_constant_fold_rcp_f64_1() nounwind {
21*9880d681SAndroid Build Coastguard Worker  %val = call double @llvm.amdgcn.rcp.f64(double 1.0) nounwind readnone
22*9880d681SAndroid Build Coastguard Worker  ret double %val
23*9880d681SAndroid Build Coastguard Worker}
24*9880d681SAndroid Build Coastguard Worker
25*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_rcp_f32_half
26*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret float 2.000000e+00
27*9880d681SAndroid Build Coastguard Workerdefine float @test_constant_fold_rcp_f32_half() nounwind {
28*9880d681SAndroid Build Coastguard Worker  %val = call float @llvm.amdgcn.rcp.f32(float 0.5) nounwind readnone
29*9880d681SAndroid Build Coastguard Worker  ret float %val
30*9880d681SAndroid Build Coastguard Worker}
31*9880d681SAndroid Build Coastguard Worker
32*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_rcp_f64_half
33*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  ret double 2.000000e+00
34*9880d681SAndroid Build Coastguard Workerdefine double @test_constant_fold_rcp_f64_half() nounwind {
35*9880d681SAndroid Build Coastguard Worker  %val = call double @llvm.amdgcn.rcp.f64(double 0.5) nounwind readnone
36*9880d681SAndroid Build Coastguard Worker  ret double %val
37*9880d681SAndroid Build Coastguard Worker}
38*9880d681SAndroid Build Coastguard Worker
39*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_rcp_f32_43
40*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: call float @llvm.amdgcn.rcp.f32(float 4.300000e+01)
41*9880d681SAndroid Build Coastguard Workerdefine float @test_constant_fold_rcp_f32_43() nounwind {
42*9880d681SAndroid Build Coastguard Worker %val = call float @llvm.amdgcn.rcp.f32(float 4.300000e+01) nounwind readnone
43*9880d681SAndroid Build Coastguard Worker ret float %val
44*9880d681SAndroid Build Coastguard Worker}
45*9880d681SAndroid Build Coastguard Worker
46*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_rcp_f64_43
47*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: call double @llvm.amdgcn.rcp.f64(double 4.300000e+01)
48*9880d681SAndroid Build Coastguard Workerdefine double @test_constant_fold_rcp_f64_43() nounwind {
49*9880d681SAndroid Build Coastguard Worker  %val = call double @llvm.amdgcn.rcp.f64(double 4.300000e+01) nounwind readnone
50*9880d681SAndroid Build Coastguard Worker  ret double %val
51*9880d681SAndroid Build Coastguard Worker}
52*9880d681SAndroid Build Coastguard Worker
53*9880d681SAndroid Build Coastguard Worker
54*9880d681SAndroid Build Coastguard Worker; --------------------------------------------------------------------
55*9880d681SAndroid Build Coastguard Worker; llvm.amdgcn.frexp.mant
56*9880d681SAndroid Build Coastguard Worker; --------------------------------------------------------------------
57*9880d681SAndroid Build Coastguard Worker
58*9880d681SAndroid Build Coastguard Workerdeclare float @llvm.amdgcn.frexp.mant.f32(float) nounwind readnone
59*9880d681SAndroid Build Coastguard Workerdeclare double @llvm.amdgcn.frexp.mant.f64(double) nounwind readnone
60*9880d681SAndroid Build Coastguard Worker
61*9880d681SAndroid Build Coastguard Worker
62*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_mant_f32_undef(
63*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret float undef
64*9880d681SAndroid Build Coastguard Workerdefine float @test_constant_fold_frexp_mant_f32_undef() nounwind {
65*9880d681SAndroid Build Coastguard Worker  %val = call float @llvm.amdgcn.frexp.mant.f32(float undef)
66*9880d681SAndroid Build Coastguard Worker  ret float %val
67*9880d681SAndroid Build Coastguard Worker}
68*9880d681SAndroid Build Coastguard Worker
69*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_mant_f64_undef(
70*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  ret double undef
71*9880d681SAndroid Build Coastguard Workerdefine double @test_constant_fold_frexp_mant_f64_undef() nounwind {
72*9880d681SAndroid Build Coastguard Worker  %val = call double @llvm.amdgcn.frexp.mant.f64(double undef)
73*9880d681SAndroid Build Coastguard Worker  ret double %val
74*9880d681SAndroid Build Coastguard Worker}
75*9880d681SAndroid Build Coastguard Worker
76*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_mant_f32_0(
77*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret float 0.000000e+00
78*9880d681SAndroid Build Coastguard Workerdefine float @test_constant_fold_frexp_mant_f32_0() nounwind {
79*9880d681SAndroid Build Coastguard Worker  %val = call float @llvm.amdgcn.frexp.mant.f32(float 0.0)
80*9880d681SAndroid Build Coastguard Worker  ret float %val
81*9880d681SAndroid Build Coastguard Worker}
82*9880d681SAndroid Build Coastguard Worker
83*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_mant_f64_0(
84*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  ret double 0.000000e+00
85*9880d681SAndroid Build Coastguard Workerdefine double @test_constant_fold_frexp_mant_f64_0() nounwind {
86*9880d681SAndroid Build Coastguard Worker  %val = call double @llvm.amdgcn.frexp.mant.f64(double 0.0)
87*9880d681SAndroid Build Coastguard Worker  ret double %val
88*9880d681SAndroid Build Coastguard Worker}
89*9880d681SAndroid Build Coastguard Worker
90*9880d681SAndroid Build Coastguard Worker
91*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_mant_f32_n0(
92*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret float -0.000000e+00
93*9880d681SAndroid Build Coastguard Workerdefine float @test_constant_fold_frexp_mant_f32_n0() nounwind {
94*9880d681SAndroid Build Coastguard Worker  %val = call float @llvm.amdgcn.frexp.mant.f32(float -0.0)
95*9880d681SAndroid Build Coastguard Worker  ret float %val
96*9880d681SAndroid Build Coastguard Worker}
97*9880d681SAndroid Build Coastguard Worker
98*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_mant_f64_n0(
99*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  ret double -0.000000e+00
100*9880d681SAndroid Build Coastguard Workerdefine double @test_constant_fold_frexp_mant_f64_n0() nounwind {
101*9880d681SAndroid Build Coastguard Worker  %val = call double @llvm.amdgcn.frexp.mant.f64(double -0.0)
102*9880d681SAndroid Build Coastguard Worker  ret double %val
103*9880d681SAndroid Build Coastguard Worker}
104*9880d681SAndroid Build Coastguard Worker
105*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_mant_f32_1(
106*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret float 5.000000e-01
107*9880d681SAndroid Build Coastguard Workerdefine float @test_constant_fold_frexp_mant_f32_1() nounwind {
108*9880d681SAndroid Build Coastguard Worker  %val = call float @llvm.amdgcn.frexp.mant.f32(float 1.0)
109*9880d681SAndroid Build Coastguard Worker  ret float %val
110*9880d681SAndroid Build Coastguard Worker}
111*9880d681SAndroid Build Coastguard Worker
112*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_mant_f64_1(
113*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  ret double 5.000000e-01
114*9880d681SAndroid Build Coastguard Workerdefine double @test_constant_fold_frexp_mant_f64_1() nounwind {
115*9880d681SAndroid Build Coastguard Worker  %val = call double @llvm.amdgcn.frexp.mant.f64(double 1.0)
116*9880d681SAndroid Build Coastguard Worker  ret double %val
117*9880d681SAndroid Build Coastguard Worker}
118*9880d681SAndroid Build Coastguard Worker
119*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_mant_f32_n1(
120*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret float -5.000000e-01
121*9880d681SAndroid Build Coastguard Workerdefine float @test_constant_fold_frexp_mant_f32_n1() nounwind {
122*9880d681SAndroid Build Coastguard Worker  %val = call float @llvm.amdgcn.frexp.mant.f32(float -1.0)
123*9880d681SAndroid Build Coastguard Worker  ret float %val
124*9880d681SAndroid Build Coastguard Worker}
125*9880d681SAndroid Build Coastguard Worker
126*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_mant_f64_n1(
127*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  ret double -5.000000e-01
128*9880d681SAndroid Build Coastguard Workerdefine double @test_constant_fold_frexp_mant_f64_n1() nounwind {
129*9880d681SAndroid Build Coastguard Worker  %val = call double @llvm.amdgcn.frexp.mant.f64(double -1.0)
130*9880d681SAndroid Build Coastguard Worker  ret double %val
131*9880d681SAndroid Build Coastguard Worker}
132*9880d681SAndroid Build Coastguard Worker
133*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_mant_f32_nan(
134*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret float 0x7FF8000000000000
135*9880d681SAndroid Build Coastguard Workerdefine float @test_constant_fold_frexp_mant_f32_nan() nounwind {
136*9880d681SAndroid Build Coastguard Worker  %val = call float @llvm.amdgcn.frexp.mant.f32(float 0x7FF8000000000000)
137*9880d681SAndroid Build Coastguard Worker  ret float %val
138*9880d681SAndroid Build Coastguard Worker}
139*9880d681SAndroid Build Coastguard Worker
140*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_mant_f64_nan(
141*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  ret double 0x7FF8000000000000
142*9880d681SAndroid Build Coastguard Workerdefine double @test_constant_fold_frexp_mant_f64_nan() nounwind {
143*9880d681SAndroid Build Coastguard Worker  %val = call double @llvm.amdgcn.frexp.mant.f64(double 0x7FF8000000000000)
144*9880d681SAndroid Build Coastguard Worker  ret double %val
145*9880d681SAndroid Build Coastguard Worker}
146*9880d681SAndroid Build Coastguard Worker
147*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_mant_f32_inf(
148*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret float 0x7FF0000000000000
149*9880d681SAndroid Build Coastguard Workerdefine float @test_constant_fold_frexp_mant_f32_inf() nounwind {
150*9880d681SAndroid Build Coastguard Worker  %val = call float @llvm.amdgcn.frexp.mant.f32(float 0x7FF0000000000000)
151*9880d681SAndroid Build Coastguard Worker  ret float %val
152*9880d681SAndroid Build Coastguard Worker}
153*9880d681SAndroid Build Coastguard Worker
154*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_mant_f64_inf(
155*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  ret double 0x7FF0000000000000
156*9880d681SAndroid Build Coastguard Workerdefine double @test_constant_fold_frexp_mant_f64_inf() nounwind {
157*9880d681SAndroid Build Coastguard Worker  %val = call double @llvm.amdgcn.frexp.mant.f64(double 0x7FF0000000000000)
158*9880d681SAndroid Build Coastguard Worker  ret double %val
159*9880d681SAndroid Build Coastguard Worker}
160*9880d681SAndroid Build Coastguard Worker
161*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_mant_f32_ninf(
162*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret float 0xFFF0000000000000
163*9880d681SAndroid Build Coastguard Workerdefine float @test_constant_fold_frexp_mant_f32_ninf() nounwind {
164*9880d681SAndroid Build Coastguard Worker  %val = call float @llvm.amdgcn.frexp.mant.f32(float 0xFFF0000000000000)
165*9880d681SAndroid Build Coastguard Worker  ret float %val
166*9880d681SAndroid Build Coastguard Worker}
167*9880d681SAndroid Build Coastguard Worker
168*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_mant_f64_ninf(
169*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  ret double 0xFFF0000000000000
170*9880d681SAndroid Build Coastguard Workerdefine double @test_constant_fold_frexp_mant_f64_ninf() nounwind {
171*9880d681SAndroid Build Coastguard Worker  %val = call double @llvm.amdgcn.frexp.mant.f64(double 0xFFF0000000000000)
172*9880d681SAndroid Build Coastguard Worker  ret double %val
173*9880d681SAndroid Build Coastguard Worker}
174*9880d681SAndroid Build Coastguard Worker
175*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_mant_f32_max_num(
176*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret float 0x3FEFFFFFE0000000
177*9880d681SAndroid Build Coastguard Workerdefine float @test_constant_fold_frexp_mant_f32_max_num() nounwind {
178*9880d681SAndroid Build Coastguard Worker  %val = call float @llvm.amdgcn.frexp.mant.f32(float 0x47EFFFFFE0000000)
179*9880d681SAndroid Build Coastguard Worker  ret float %val
180*9880d681SAndroid Build Coastguard Worker}
181*9880d681SAndroid Build Coastguard Worker
182*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_mant_f64_max_num(
183*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  ret double 0x3FEFFFFFFFFFFFFF
184*9880d681SAndroid Build Coastguard Workerdefine double @test_constant_fold_frexp_mant_f64_max_num() nounwind {
185*9880d681SAndroid Build Coastguard Worker  %val = call double @llvm.amdgcn.frexp.mant.f64(double 0x7FEFFFFFFFFFFFFF)
186*9880d681SAndroid Build Coastguard Worker  ret double %val
187*9880d681SAndroid Build Coastguard Worker}
188*9880d681SAndroid Build Coastguard Worker
189*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_mant_f32_min_num(
190*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret float 5.000000e-01
191*9880d681SAndroid Build Coastguard Workerdefine float @test_constant_fold_frexp_mant_f32_min_num() nounwind {
192*9880d681SAndroid Build Coastguard Worker  %val = call float @llvm.amdgcn.frexp.mant.f32(float 0x36A0000000000000)
193*9880d681SAndroid Build Coastguard Worker  ret float %val
194*9880d681SAndroid Build Coastguard Worker}
195*9880d681SAndroid Build Coastguard Worker
196*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_mant_f64_min_num(
197*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  ret double 5.000000e-01
198*9880d681SAndroid Build Coastguard Workerdefine double @test_constant_fold_frexp_mant_f64_min_num() nounwind {
199*9880d681SAndroid Build Coastguard Worker  %val = call double @llvm.amdgcn.frexp.mant.f64(double 4.940656e-324)
200*9880d681SAndroid Build Coastguard Worker  ret double %val
201*9880d681SAndroid Build Coastguard Worker}
202*9880d681SAndroid Build Coastguard Worker
203*9880d681SAndroid Build Coastguard Worker
204*9880d681SAndroid Build Coastguard Worker; --------------------------------------------------------------------
205*9880d681SAndroid Build Coastguard Worker; llvm.amdgcn.frexp.exp
206*9880d681SAndroid Build Coastguard Worker; --------------------------------------------------------------------
207*9880d681SAndroid Build Coastguard Worker
208*9880d681SAndroid Build Coastguard Workerdeclare i32 @llvm.amdgcn.frexp.exp.f32(float) nounwind readnone
209*9880d681SAndroid Build Coastguard Workerdeclare i32 @llvm.amdgcn.frexp.exp.f64(double) nounwind readnone
210*9880d681SAndroid Build Coastguard Worker
211*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_exp_f32_undef(
212*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret i32 undef
213*9880d681SAndroid Build Coastguard Workerdefine i32 @test_constant_fold_frexp_exp_f32_undef() nounwind {
214*9880d681SAndroid Build Coastguard Worker  %val = call i32 @llvm.amdgcn.frexp.exp.f32(float undef)
215*9880d681SAndroid Build Coastguard Worker  ret i32 %val
216*9880d681SAndroid Build Coastguard Worker}
217*9880d681SAndroid Build Coastguard Worker
218*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_exp_f64_undef(
219*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  ret i32 undef
220*9880d681SAndroid Build Coastguard Workerdefine i32 @test_constant_fold_frexp_exp_f64_undef() nounwind {
221*9880d681SAndroid Build Coastguard Worker  %val = call i32 @llvm.amdgcn.frexp.exp.f64(double undef)
222*9880d681SAndroid Build Coastguard Worker  ret i32 %val
223*9880d681SAndroid Build Coastguard Worker}
224*9880d681SAndroid Build Coastguard Worker
225*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_exp_f32_0(
226*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret i32 0
227*9880d681SAndroid Build Coastguard Workerdefine i32 @test_constant_fold_frexp_exp_f32_0() nounwind {
228*9880d681SAndroid Build Coastguard Worker  %val = call i32 @llvm.amdgcn.frexp.exp.f32(float 0.0)
229*9880d681SAndroid Build Coastguard Worker  ret i32 %val
230*9880d681SAndroid Build Coastguard Worker}
231*9880d681SAndroid Build Coastguard Worker
232*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_exp_f64_0(
233*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  ret i32 0
234*9880d681SAndroid Build Coastguard Workerdefine i32 @test_constant_fold_frexp_exp_f64_0() nounwind {
235*9880d681SAndroid Build Coastguard Worker  %val = call i32 @llvm.amdgcn.frexp.exp.f64(double 0.0)
236*9880d681SAndroid Build Coastguard Worker  ret i32 %val
237*9880d681SAndroid Build Coastguard Worker}
238*9880d681SAndroid Build Coastguard Worker
239*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_exp_f32_n0(
240*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret i32 0
241*9880d681SAndroid Build Coastguard Workerdefine i32 @test_constant_fold_frexp_exp_f32_n0() nounwind {
242*9880d681SAndroid Build Coastguard Worker  %val = call i32 @llvm.amdgcn.frexp.exp.f32(float -0.0)
243*9880d681SAndroid Build Coastguard Worker  ret i32 %val
244*9880d681SAndroid Build Coastguard Worker}
245*9880d681SAndroid Build Coastguard Worker
246*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_exp_f64_n0(
247*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  ret i32 0
248*9880d681SAndroid Build Coastguard Workerdefine i32 @test_constant_fold_frexp_exp_f64_n0() nounwind {
249*9880d681SAndroid Build Coastguard Worker  %val = call i32 @llvm.amdgcn.frexp.exp.f64(double -0.0)
250*9880d681SAndroid Build Coastguard Worker  ret i32 %val
251*9880d681SAndroid Build Coastguard Worker}
252*9880d681SAndroid Build Coastguard Worker
253*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_exp_f32_1024(
254*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret i32 11
255*9880d681SAndroid Build Coastguard Workerdefine i32 @test_constant_fold_frexp_exp_f32_1024() nounwind {
256*9880d681SAndroid Build Coastguard Worker  %val = call i32 @llvm.amdgcn.frexp.exp.f32(float 1024.0)
257*9880d681SAndroid Build Coastguard Worker  ret i32 %val
258*9880d681SAndroid Build Coastguard Worker}
259*9880d681SAndroid Build Coastguard Worker
260*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_exp_f64_1024(
261*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  ret i32 11
262*9880d681SAndroid Build Coastguard Workerdefine i32 @test_constant_fold_frexp_exp_f64_1024() nounwind {
263*9880d681SAndroid Build Coastguard Worker  %val = call i32 @llvm.amdgcn.frexp.exp.f64(double 1024.0)
264*9880d681SAndroid Build Coastguard Worker  ret i32 %val
265*9880d681SAndroid Build Coastguard Worker}
266*9880d681SAndroid Build Coastguard Worker
267*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_exp_f32_n1024(
268*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret i32 11
269*9880d681SAndroid Build Coastguard Workerdefine i32 @test_constant_fold_frexp_exp_f32_n1024() nounwind {
270*9880d681SAndroid Build Coastguard Worker  %val = call i32 @llvm.amdgcn.frexp.exp.f32(float -1024.0)
271*9880d681SAndroid Build Coastguard Worker  ret i32 %val
272*9880d681SAndroid Build Coastguard Worker}
273*9880d681SAndroid Build Coastguard Worker
274*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_exp_f64_n1024(
275*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  ret i32 11
276*9880d681SAndroid Build Coastguard Workerdefine i32 @test_constant_fold_frexp_exp_f64_n1024() nounwind {
277*9880d681SAndroid Build Coastguard Worker  %val = call i32 @llvm.amdgcn.frexp.exp.f64(double -1024.0)
278*9880d681SAndroid Build Coastguard Worker  ret i32 %val
279*9880d681SAndroid Build Coastguard Worker}
280*9880d681SAndroid Build Coastguard Worker
281*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_exp_f32_1_1024(
282*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret i32 -9
283*9880d681SAndroid Build Coastguard Workerdefine i32 @test_constant_fold_frexp_exp_f32_1_1024() nounwind {
284*9880d681SAndroid Build Coastguard Worker  %val = call i32 @llvm.amdgcn.frexp.exp.f32(float 0.0009765625)
285*9880d681SAndroid Build Coastguard Worker  ret i32 %val
286*9880d681SAndroid Build Coastguard Worker}
287*9880d681SAndroid Build Coastguard Worker
288*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_exp_f64_1_1024(
289*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  ret i32 -9
290*9880d681SAndroid Build Coastguard Workerdefine i32 @test_constant_fold_frexp_exp_f64_1_1024() nounwind {
291*9880d681SAndroid Build Coastguard Worker  %val = call i32 @llvm.amdgcn.frexp.exp.f64(double 0.0009765625)
292*9880d681SAndroid Build Coastguard Worker  ret i32 %val
293*9880d681SAndroid Build Coastguard Worker}
294*9880d681SAndroid Build Coastguard Worker
295*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_exp_f32_nan(
296*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret i32 0
297*9880d681SAndroid Build Coastguard Workerdefine i32 @test_constant_fold_frexp_exp_f32_nan() nounwind {
298*9880d681SAndroid Build Coastguard Worker  %val = call i32 @llvm.amdgcn.frexp.exp.f32(float 0x7FF8000000000000)
299*9880d681SAndroid Build Coastguard Worker  ret i32 %val
300*9880d681SAndroid Build Coastguard Worker}
301*9880d681SAndroid Build Coastguard Worker
302*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_exp_f64_nan(
303*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  ret i32 0
304*9880d681SAndroid Build Coastguard Workerdefine i32 @test_constant_fold_frexp_exp_f64_nan() nounwind {
305*9880d681SAndroid Build Coastguard Worker  %val = call i32 @llvm.amdgcn.frexp.exp.f64(double 0x7FF8000000000000)
306*9880d681SAndroid Build Coastguard Worker  ret i32 %val
307*9880d681SAndroid Build Coastguard Worker}
308*9880d681SAndroid Build Coastguard Worker
309*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_exp_f32_inf(
310*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret i32 0
311*9880d681SAndroid Build Coastguard Workerdefine i32 @test_constant_fold_frexp_exp_f32_inf() nounwind {
312*9880d681SAndroid Build Coastguard Worker  %val = call i32 @llvm.amdgcn.frexp.exp.f32(float 0x7FF0000000000000)
313*9880d681SAndroid Build Coastguard Worker  ret i32 %val
314*9880d681SAndroid Build Coastguard Worker}
315*9880d681SAndroid Build Coastguard Worker
316*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_exp_f64_inf(
317*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  ret i32 0
318*9880d681SAndroid Build Coastguard Workerdefine i32 @test_constant_fold_frexp_exp_f64_inf() nounwind {
319*9880d681SAndroid Build Coastguard Worker  %val = call i32 @llvm.amdgcn.frexp.exp.f64(double 0x7FF0000000000000)
320*9880d681SAndroid Build Coastguard Worker  ret i32 %val
321*9880d681SAndroid Build Coastguard Worker}
322*9880d681SAndroid Build Coastguard Worker
323*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_exp_f32_ninf(
324*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret i32 0
325*9880d681SAndroid Build Coastguard Workerdefine i32 @test_constant_fold_frexp_exp_f32_ninf() nounwind {
326*9880d681SAndroid Build Coastguard Worker  %val = call i32 @llvm.amdgcn.frexp.exp.f32(float 0xFFF0000000000000)
327*9880d681SAndroid Build Coastguard Worker  ret i32 %val
328*9880d681SAndroid Build Coastguard Worker}
329*9880d681SAndroid Build Coastguard Worker
330*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_exp_f64_ninf(
331*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  ret i32 0
332*9880d681SAndroid Build Coastguard Workerdefine i32 @test_constant_fold_frexp_exp_f64_ninf() nounwind {
333*9880d681SAndroid Build Coastguard Worker  %val = call i32 @llvm.amdgcn.frexp.exp.f64(double 0xFFF0000000000000)
334*9880d681SAndroid Build Coastguard Worker  ret i32 %val
335*9880d681SAndroid Build Coastguard Worker}
336*9880d681SAndroid Build Coastguard Worker
337*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_exp_f32_max_num(
338*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret i32 128
339*9880d681SAndroid Build Coastguard Workerdefine i32 @test_constant_fold_frexp_exp_f32_max_num() nounwind {
340*9880d681SAndroid Build Coastguard Worker  %val = call i32 @llvm.amdgcn.frexp.exp.f32(float 0x47EFFFFFE0000000)
341*9880d681SAndroid Build Coastguard Worker  ret i32 %val
342*9880d681SAndroid Build Coastguard Worker}
343*9880d681SAndroid Build Coastguard Worker
344*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_exp_f64_max_num(
345*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  ret i32 1024
346*9880d681SAndroid Build Coastguard Workerdefine i32 @test_constant_fold_frexp_exp_f64_max_num() nounwind {
347*9880d681SAndroid Build Coastguard Worker  %val = call i32 @llvm.amdgcn.frexp.exp.f64(double 0x7FEFFFFFFFFFFFFF)
348*9880d681SAndroid Build Coastguard Worker  ret i32 %val
349*9880d681SAndroid Build Coastguard Worker}
350*9880d681SAndroid Build Coastguard Worker
351*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_exp_f32_min_num(
352*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret i32 -148
353*9880d681SAndroid Build Coastguard Workerdefine i32 @test_constant_fold_frexp_exp_f32_min_num() nounwind {
354*9880d681SAndroid Build Coastguard Worker  %val = call i32 @llvm.amdgcn.frexp.exp.f32(float 0x36A0000000000000)
355*9880d681SAndroid Build Coastguard Worker  ret i32 %val
356*9880d681SAndroid Build Coastguard Worker}
357*9880d681SAndroid Build Coastguard Worker
358*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_constant_fold_frexp_exp_f64_min_num(
359*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  ret i32 -1073
360*9880d681SAndroid Build Coastguard Workerdefine i32 @test_constant_fold_frexp_exp_f64_min_num() nounwind {
361*9880d681SAndroid Build Coastguard Worker  %val = call i32 @llvm.amdgcn.frexp.exp.f64(double 4.940656e-324)
362*9880d681SAndroid Build Coastguard Worker  ret i32 %val
363*9880d681SAndroid Build Coastguard Worker}
364*9880d681SAndroid Build Coastguard Worker
365