[llvm] [InstSimply] Add tests for simplify `(fmul -x, +/-0)` -> `-/+0` (PR #85345)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 14 23:58:10 PDT 2024


================
@@ -211,6 +211,22 @@ define double @fmul_nnan_ninf_nneg_n0.0_commute(i127 %x) {
   ret double %r
 }
 
+define float @src_mul_nzero_neg(float nofpclass(inf nan pzero psub pnorm) %f) {
+; CHECK-LABEL: @src_mul_nzero_neg(
+; CHECK-NEXT:    ret float 0.000000e+00
+;
+  %r = fmul float %f, -0.0
+  ret float %r
+}
+
+define float @src_mul_zero_neg(float nofpclass(inf nan pzero psub pnorm) %f) {
+; CHECK-LABEL: @src_mul_zero_neg(
+; CHECK-NEXT:    ret float -0.000000e+00
+;
+  %r = fmul float %f, 0.0
+  ret float %r
+}
+
----------------
arsenm wrote:

Can you also test the FMA / fmuladd cases? Also vectors 

https://github.com/llvm/llvm-project/pull/85345


More information about the llvm-commits mailing list