[Mlir-commits] [mlir] [mlir][test] Ignore NaN sign in test case (PR #194875)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Apr 29 07:47:41 PDT 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: XYenChi

<details>
<summary>Changes</summary>

IEEE 754-2008 (section 6.3) does not specify the sign bit of a NaN result for most floating-point operations. While certain bitwise operations (e.g., copy, negate, abs, copySign) may define or propagate the sign bit, general arithmetic operations are not required to do so.

This test currently assumes a specific NaN sign, which is not portable across targets. It fails on RISC-V due to differing NaN sign behavior.

Relax the test to ignore the NaN sign.

---
Full diff: https://github.com/llvm/llvm-project/pull/194875.diff


1 Files Affected:

- (modified) mlir/test/mlir-runner/test-expand-math-approx.mlir (+2-2) 


``````````diff
diff --git a/mlir/test/mlir-runner/test-expand-math-approx.mlir b/mlir/test/mlir-runner/test-expand-math-approx.mlir
index 06b3171a2349e..5ba0f7106e101 100644
--- a/mlir/test/mlir-runner/test-expand-math-approx.mlir
+++ b/mlir/test/mlir-runner/test-expand-math-approx.mlir
@@ -233,12 +233,12 @@ func.func @powf() {
   %g_p = arith.constant 23598.0 : f64
   call @func_powff64(%g, %g_p) : (f64, f64) -> ()
 
-  // CHECK-NEXT: -nan
+  // CHECK-NEXT: {{-?}}nan
   %h = arith.constant 1.0 : f64
   %h_p = arith.constant 0xfff0000001000000 : f64
   call @func_powff64(%h, %h_p) : (f64, f64) -> ()
 
-  // CHECK-NEXT: -nan
+  // CHECK-NEXT: {{-?}}nan
   %i = arith.constant 1.0 : f32
   %i_p = arith.constant 0xffffffff : f32
   call @func_powff32(%i, %i_p) : (f32, f32) -> ()

``````````

</details>


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


More information about the Mlir-commits mailing list