You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SimplifyLibCalls: Don't require ldexp to emit intrinsic in exp2 combine
When folding exp2(itofp(x)) to ldexp(1, x), don't require an ldexp libcall
to emit the intrinsic.
The intrinsic needs to be handled regardless of whether the system
has a libcall, and we have an inline implementation of ldexp already.
This fixes the instance in the exp2->ldexp fold. Another instance exists
for the pow(2) -> ldexp case
The LTO test change isn't ideal, since it's just moving the problem to
another instance where we're relying on implied libm behavior for an
intrinsic transform. Use exp10 since that's a harder case to solve in
the libcall house of cards we have.
define <vscale x 4 x float> @exp2_nxv4f32_sitofp_i8(<vscale x 4 x i8> %x) {
126
-
; LDEXP-LABEL: define <vscale x 4 x float> @exp2_nxv4f32_sitofp_i8(
127
-
; LDEXP-SAME: <vscale x 4 x i8> [[X:%.*]]) {
128
-
; LDEXP-NEXT: [[TMP1:%.*]] = sext <vscale x 4 x i8> [[X]] to <vscale x 4 x i32>
129
-
; LDEXP-NEXT: [[EXP2:%.*]] = call <vscale x 4 x float> @llvm.ldexp.nxv4f32.nxv4i32(<vscale x 4 x float> shufflevector (<vscale x 4 x float> insertelement (<vscale x 4 x float> poison, float 1.000000e+00, i64 0), <vscale x 4 x float> poison, <vscale x 4 x i32> zeroinitializer), <vscale x 4 x i32> [[TMP1]])
130
-
; LDEXP-NEXT: ret <vscale x 4 x float> [[EXP2]]
131
-
;
132
-
; NOLDEXP-LABEL: define <vscale x 4 x float> @exp2_nxv4f32_sitofp_i8(
133
-
; NOLDEXP-SAME: <vscale x 4 x i8> [[X:%.*]]) {
134
-
; NOLDEXP-NEXT: [[ITOFP:%.*]] = sitofp <vscale x 4 x i8> [[X]] to <vscale x 4 x float>
135
-
; NOLDEXP-NEXT: [[EXP2:%.*]] = call <vscale x 4 x float> @llvm.exp2.nxv4f32(<vscale x 4 x float> [[ITOFP]])
136
-
; NOLDEXP-NEXT: ret <vscale x 4 x float> [[EXP2]]
90
+
; CHECK-LABEL: define <vscale x 4 x float> @exp2_nxv4f32_sitofp_i8(
91
+
; CHECK-SAME: <vscale x 4 x i8> [[X:%.*]]) {
92
+
; CHECK-NEXT: [[TMP1:%.*]] = sext <vscale x 4 x i8> [[X]] to <vscale x 4 x i32>
93
+
; CHECK-NEXT: [[EXP2:%.*]] = call <vscale x 4 x float> @llvm.ldexp.nxv4f32.nxv4i32(<vscale x 4 x float> shufflevector (<vscale x 4 x float> insertelement (<vscale x 4 x float> poison, float 1.000000e+00, i64 0), <vscale x 4 x float> poison, <vscale x 4 x i32> zeroinitializer), <vscale x 4 x i32> [[TMP1]])
94
+
; CHECK-NEXT: ret <vscale x 4 x float> [[EXP2]]
137
95
;
138
96
%itofp = sitofp <vscale x 4 x i8> %xto <vscale x 4 x float>
139
97
%exp2 = call <vscale x 4 x float> @llvm.exp2.nxv4f32(<vscale x 4 x float> %itofp)
0 commit comments