Skip to content

Commit b7244bc

Browse files
committed
[InstSimply] Add tests for simplify (fmul -x, +/-0); NFC
1 parent 70d0ebb commit b7244bc

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,24 @@ define double @fmul_nnan_ninf_nneg_n0.0_commute(i127 %x) {
211211
ret double %r
212212
}
213213

214+
define float @src_mul_nzero_neg(float nofpclass(inf nan pzero psub pnorm) %f) {
215+
; CHECK-LABEL: @src_mul_nzero_neg(
216+
; CHECK-NEXT: [[R:%.*]] = fmul float [[F:%.*]], -0.000000e+00
217+
; CHECK-NEXT: ret float [[R]]
218+
;
219+
%r = fmul float %f, -0.0
220+
ret float %r
221+
}
222+
223+
define float @src_mul_zero_neg(float nofpclass(inf nan pzero psub pnorm) %f) {
224+
; CHECK-LABEL: @src_mul_zero_neg(
225+
; CHECK-NEXT: [[R:%.*]] = fmul float [[F:%.*]], 0.000000e+00
226+
; CHECK-NEXT: ret float [[R]]
227+
;
228+
%r = fmul float %f, 0.0
229+
ret float %r
230+
}
231+
214232
; Make sure we can infer %x can't be 0 based on assumes.
215233
define { float, float } @test_fmul_0_assumed_finite(float %x) {
216234
; CHECK-LABEL: @test_fmul_0_assumed_finite(

0 commit comments

Comments
 (0)