1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
2 ; RUN: opt -S -passes=instsimplify %s | FileCheck %s
4 declare float @llvm.exp10.f32(float)
5 declare <2 x float> @llvm.exp10.v2f32(<2 x float>)
6 declare <4 x float> @llvm.exp10.v4f32(<4 x float>)
7 declare ppc_fp128 @llvm.exp10.ppcf128(ppc_fp128)
8 declare <vscale x 2 x float> @llvm.exp10.nxv2f32(<vscale x 2 x float>)
11 define float @exp10_exp10(float %x) {
12 ; CHECK-LABEL: define float @exp10_exp10(
13 ; CHECK-SAME: float [[X:%.*]]) {
14 ; CHECK-NEXT: [[EXP100:%.*]] = call float @llvm.exp10.f32(float [[X]])
15 ; CHECK-NEXT: [[EXP101:%.*]] = call float @llvm.exp10.f32(float [[EXP100]])
16 ; CHECK-NEXT: ret float [[EXP101]]
18 %exp100 = call float @llvm.exp10.f32(float %x)
19 %exp101 = call float @llvm.exp10.f32(float %exp100)
23 define <2 x float> @exp10_exp10_vector(<2 x float> %x) {
24 ; CHECK-LABEL: define <2 x float> @exp10_exp10_vector(
25 ; CHECK-SAME: <2 x float> [[X:%.*]]) {
26 ; CHECK-NEXT: [[EXP100:%.*]] = call <2 x float> @llvm.exp10.v2f32(<2 x float> [[X]])
27 ; CHECK-NEXT: [[EXP101:%.*]] = call <2 x float> @llvm.exp10.v2f32(<2 x float> [[EXP100]])
28 ; CHECK-NEXT: ret <2 x float> [[EXP101]]
30 %exp100 = call <2 x float> @llvm.exp10.v2f32(<2 x float> %x)
31 %exp101 = call <2 x float> @llvm.exp10.v2f32(<2 x float> %exp100)
32 ret <2 x float> %exp101
35 define float @exp10_exp10_const(float %x) {
36 ; CHECK-LABEL: define float @exp10_exp10_const(
37 ; CHECK-SAME: float [[X:%.*]]) {
38 ; CHECK-NEXT: [[EXP101:%.*]] = call float @llvm.exp10.f32(float 0x7FF0000000000000)
39 ; CHECK-NEXT: ret float [[EXP101]]
41 %exp100 = call float @llvm.exp10.f32(float 42.0)
42 %exp101 = call float @llvm.exp10.f32(float %exp100)
46 define <vscale x 2 x float> @exp10_exp10_scalable_vector(<vscale x 2 x float> %x) {
47 ; CHECK-LABEL: define <vscale x 2 x float> @exp10_exp10_scalable_vector(
48 ; CHECK-SAME: <vscale x 2 x float> [[X:%.*]]) {
49 ; CHECK-NEXT: [[EXP100:%.*]] = call <vscale x 2 x float> @llvm.exp10.nxv2f32(<vscale x 2 x float> [[X]])
50 ; CHECK-NEXT: [[EXP101:%.*]] = call <vscale x 2 x float> @llvm.exp10.nxv2f32(<vscale x 2 x float> [[EXP100]])
51 ; CHECK-NEXT: ret <vscale x 2 x float> [[EXP101]]
53 %exp100 = call <vscale x 2 x float> @llvm.exp10.nxv2f32(<vscale x 2 x float> %x)
54 %exp101 = call <vscale x 2 x float> @llvm.exp10.nxv2f32(<vscale x 2 x float> %exp100)
55 ret <vscale x 2 x float> %exp101
58 define float @exp10_poison() {
59 ; CHECK-LABEL: define float @exp10_poison() {
60 ; CHECK-NEXT: [[RET:%.*]] = call float @llvm.exp10.f32(float poison)
61 ; CHECK-NEXT: ret float [[RET]]
63 %ret = call float @llvm.exp10.f32(float poison)
67 define <2 x float> @exp10_poison_vector() {
68 ; CHECK-LABEL: define <2 x float> @exp10_poison_vector() {
69 ; CHECK-NEXT: [[RET:%.*]] = call <2 x float> @llvm.exp10.v2f32(<2 x float> poison)
70 ; CHECK-NEXT: ret <2 x float> [[RET]]
72 %ret = call <2 x float> @llvm.exp10.v2f32(<2 x float> poison)
76 define <vscale x 2 x float> @exp10_poison_scaleable_vector() {
77 ; CHECK-LABEL: define <vscale x 2 x float> @exp10_poison_scaleable_vector() {
78 ; CHECK-NEXT: [[RET:%.*]] = call <vscale x 2 x float> @llvm.exp10.nxv2f32(<vscale x 2 x float> poison)
79 ; CHECK-NEXT: ret <vscale x 2 x float> [[RET]]
81 %ret = call <vscale x 2 x float> @llvm.exp10.nxv2f32(<vscale x 2 x float> poison)
82 ret <vscale x 2 x float> %ret
85 define float @exp10_undef() {
86 ; CHECK-LABEL: define float @exp10_undef() {
87 ; CHECK-NEXT: [[RET:%.*]] = call float @llvm.exp10.f32(float undef)
88 ; CHECK-NEXT: ret float [[RET]]
90 %ret = call float @llvm.exp10.f32(float undef)
93 define <2 x float> @exp10_undef_vector() {
94 ; CHECK-LABEL: define <2 x float> @exp10_undef_vector() {
95 ; CHECK-NEXT: [[RET:%.*]] = call <2 x float> @llvm.exp10.v2f32(<2 x float> undef)
96 ; CHECK-NEXT: ret <2 x float> [[RET]]
98 %ret = call <2 x float> @llvm.exp10.v2f32(<2 x float> undef)
102 define <2 x float> @exp10_zero_vector() {
103 ; CHECK-LABEL: define <2 x float> @exp10_zero_vector() {
104 ; CHECK-NEXT: ret <2 x float> splat (float 1.000000e+00)
106 %ret = call <2 x float> @llvm.exp10.v2f32(<2 x float> zeroinitializer)
110 define <vscale x 2 x float> @exp10_zero_scalable_vector() {
111 ; CHECK-LABEL: define <vscale x 2 x float> @exp10_zero_scalable_vector() {
112 ; CHECK-NEXT: [[RET:%.*]] = call <vscale x 2 x float> @llvm.exp10.nxv2f32(<vscale x 2 x float> zeroinitializer)
113 ; CHECK-NEXT: ret <vscale x 2 x float> [[RET]]
115 %ret = call <vscale x 2 x float> @llvm.exp10.nxv2f32(<vscale x 2 x float> zeroinitializer)
116 ret <vscale x 2 x float> %ret
119 define <2 x float> @exp10_zero_negzero_vector() {
120 ; CHECK-LABEL: define <2 x float> @exp10_zero_negzero_vector() {
121 ; CHECK-NEXT: ret <2 x float> splat (float 1.000000e+00)
123 %ret = call <2 x float> @llvm.exp10.v2f32(<2 x float> <float 0.0, float -0.0>)
127 define <4 x float> @exp10_nonsplat_vector() {
128 ; CHECK-LABEL: define <4 x float> @exp10_nonsplat_vector() {
129 ; CHECK-NEXT: [[RET:%.*]] = call <4 x float> @llvm.exp10.v4f32(<4 x float> <float 1.600000e+01, float -3.200000e+01, float undef, float 9.999000e+03>)
130 ; CHECK-NEXT: ret <4 x float> [[RET]]
132 %ret = call <4 x float> @llvm.exp10.v4f32(<4 x float> <float 16.0, float -32.0, float undef, float 9999.0>)
136 define float @exp10_zero() {
137 ; CHECK-LABEL: define float @exp10_zero() {
138 ; CHECK-NEXT: ret float 1.000000e+00
140 %ret = call float @llvm.exp10.f32(float 0.0)
144 define float @exp10_negzero() {
145 ; CHECK-LABEL: define float @exp10_negzero() {
146 ; CHECK-NEXT: ret float 1.000000e+00
148 %ret = call float @llvm.exp10.f32(float -0.0)
152 define float @exp10_one() {
153 ; CHECK-LABEL: define float @exp10_one() {
154 ; CHECK-NEXT: ret float 1.000000e+01
156 %ret = call float @llvm.exp10.f32(float 1.0)
160 define float @exp10_negone() {
161 ; CHECK-LABEL: define float @exp10_negone() {
162 ; CHECK-NEXT: ret float 0x3FB99999A0000000
164 %ret = call float @llvm.exp10.f32(float -1.0)
168 define float @exp10_two() {
169 ; CHECK-LABEL: define float @exp10_two() {
170 ; CHECK-NEXT: ret float 1.000000e+02
172 %ret = call float @llvm.exp10.f32(float 2.0)
176 define float @exp10_negtwo() {
177 ; CHECK-LABEL: define float @exp10_negtwo() {
178 ; CHECK-NEXT: ret float 0x3F847AE140000000
180 %ret = call float @llvm.exp10.f32(float -2.0)
184 define float @exp10_inf() {
185 ; CHECK-LABEL: define float @exp10_inf() {
186 ; CHECK-NEXT: [[RET:%.*]] = call float @llvm.exp10.f32(float 0x7FF0000000000000)
187 ; CHECK-NEXT: ret float [[RET]]
189 %ret = call float @llvm.exp10.f32(float 0x7FF0000000000000)
193 define float @exp10_neginf() {
194 ; CHECK-LABEL: define float @exp10_neginf() {
195 ; CHECK-NEXT: [[RET:%.*]] = call float @llvm.exp10.f32(float 0xFFF0000000000000)
196 ; CHECK-NEXT: ret float [[RET]]
198 %ret = call float @llvm.exp10.f32(float 0xFFF0000000000000)
202 define float @exp10_qnan() {
203 ; CHECK-LABEL: define float @exp10_qnan() {
204 ; CHECK-NEXT: [[RET:%.*]] = call float @llvm.exp10.f32(float 0x7FF8000000000000)
205 ; CHECK-NEXT: ret float [[RET]]
207 %ret = call float @llvm.exp10.f32(float 0x7FF8000000000000)
211 define float @exp10_snan() {
212 ; CHECK-LABEL: define float @exp10_snan() {
213 ; CHECK-NEXT: [[RET:%.*]] = call float @llvm.exp10.f32(float 0x7FF0000020000000)
214 ; CHECK-NEXT: ret float [[RET]]
216 %ret = call float @llvm.exp10.f32(float bitcast (i32 2139095041 to float))
220 define float @exp10_pos_denorm() {
221 ; CHECK-LABEL: define float @exp10_pos_denorm() {
222 ; CHECK-NEXT: ret float 1.000000e+00
224 %ret = call float @llvm.exp10.f32(float bitcast (i32 8388607 to float))
228 define float @exp10_neg_denorm() {
229 ; CHECK-LABEL: define float @exp10_neg_denorm() {
230 ; CHECK-NEXT: ret float 1.000000e+00
232 %ret = call float @llvm.exp10.f32(float bitcast (i32 -2139095041 to float))
236 define ppc_fp128 @exp10_one_ppcf128() {
237 ; CHECK-LABEL: define ppc_fp128 @exp10_one_ppcf128() {
238 ; CHECK-NEXT: [[RET:%.*]] = call ppc_fp128 @llvm.exp10.ppcf128(ppc_fp128 0xM3FF00000000000000000000000000000)
239 ; CHECK-NEXT: ret ppc_fp128 [[RET]]
241 %ret = call ppc_fp128 @llvm.exp10.ppcf128(ppc_fp128 0xM3FF00000000000000000000000000000)
245 define ppc_fp128 @exp10_negone_ppcf128() {
246 ; CHECK-LABEL: define ppc_fp128 @exp10_negone_ppcf128() {
247 ; CHECK-NEXT: [[RET:%.*]] = call ppc_fp128 @llvm.exp10.ppcf128(ppc_fp128 0xMBFF00000000000000000000000000000)
248 ; CHECK-NEXT: ret ppc_fp128 [[RET]]
250 %ret = call ppc_fp128 @llvm.exp10.ppcf128(ppc_fp128 0xMBFF00000000000000000000000000000)
254 define ppc_fp128 @canonicalize_noncanonical_zero_1_ppcf128() {
255 ; CHECK-LABEL: define ppc_fp128 @canonicalize_noncanonical_zero_1_ppcf128() {
256 ; CHECK-NEXT: [[RET:%.*]] = call ppc_fp128 @llvm.exp10.ppcf128(ppc_fp128 0xM00000000000000000000000000000001)
257 ; CHECK-NEXT: ret ppc_fp128 [[RET]]
259 %ret = call ppc_fp128 @llvm.exp10.ppcf128(ppc_fp128 0xM00000000000000000000000000000001)
263 define <2 x float> @exp10_splat_4() {
264 ; CHECK-LABEL: define <2 x float> @exp10_splat_4() {
265 ; CHECK-NEXT: ret <2 x float> splat (float 1.000000e+04)
267 %ret = call <2 x float> @llvm.exp10.v2f32(<2 x float> <float 4.0, float 4.0>)
271 define <2 x float> @exp10_splat_qnan() {
272 ; CHECK-LABEL: define <2 x float> @exp10_splat_qnan() {
273 ; CHECK-NEXT: [[RET:%.*]] = call <2 x float> @llvm.exp10.v2f32(<2 x float> splat (float 0x7FF8000000000000))
274 ; CHECK-NEXT: ret <2 x float> [[RET]]
276 %ret = call <2 x float> @llvm.exp10.v2f32(<2 x float> <float 0x7FF8000000000000, float 0x7FF8000000000000>)
280 define <2 x float> @exp10_splat_inf() {
281 ; CHECK-LABEL: define <2 x float> @exp10_splat_inf() {
282 ; CHECK-NEXT: [[RET:%.*]] = call <2 x float> @llvm.exp10.v2f32(<2 x float> splat (float 0x7FF0000000000000))
283 ; CHECK-NEXT: ret <2 x float> [[RET]]
285 %ret = call <2 x float> @llvm.exp10.v2f32(<2 x float> <float 0x7FF0000000000000, float 0x7FF0000000000000>)
289 define <2 x float> @exp10_splat_neginf() {
290 ; CHECK-LABEL: define <2 x float> @exp10_splat_neginf() {
291 ; CHECK-NEXT: [[RET:%.*]] = call <2 x float> @llvm.exp10.v2f32(<2 x float> splat (float 0xFFF0000000000000))
292 ; CHECK-NEXT: ret <2 x float> [[RET]]
294 %ret = call <2 x float> @llvm.exp10.v2f32(<2 x float> <float 0xFFF0000000000000, float 0xFFF0000000000000>)
298 define <2 x float> @exp10_splat_undef_inf() {
299 ; CHECK-LABEL: define <2 x float> @exp10_splat_undef_inf() {
300 ; CHECK-NEXT: [[RET:%.*]] = call <2 x float> @llvm.exp10.v2f32(<2 x float> <float undef, float 0x7FF0000000000000>)
301 ; CHECK-NEXT: ret <2 x float> [[RET]]
303 %ret = call <2 x float> @llvm.exp10.v2f32(<2 x float> <float undef, float 0x7FF0000000000000>)