[Mlir-commits] [mlir] [mlir][arith] Add mulf(x, 0) -> 0 to mulf folder (PR #161395)

Mehdi Amini llvmlistbot at llvm.org
Tue Sep 30 11:26:11 PDT 2025


================
@@ -2216,6 +2216,16 @@ func.func @test_mulf1(%arg0 : f32, %arg1 : f32) -> (f32) {
   return %2 : f32
 }
 
+// CHECK-LABEL: @test_mulf2(
+func.func @test_mulf2(%arg0 : f32, %arg1 : f32) -> (f32, f32) {
+  // CHECK-NEXT:  %[[C0:.+]] = arith.constant 0.000000e+00 : f32
+  // CHECK-NEXT:  return %[[C0]], %[[C0]]
+  %c0 = arith.constant 0.0 : f32
+  %0 = arith.mulf %arg0, %c0 : f32
+  %1 = arith.mulf %c0, %arg1 : f32
+  return %0, %1  : f32, f32
+}
----------------
joker-eph wrote:

Is nnan/ninf enough to lose the sign of the input?

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


More information about the Mlir-commits mailing list