[Mlir-commits] [mlir] [mlir][complex] Prevent underflow in complex.abs (PR #76316)

Kai Sasaki llvmlistbot at llvm.org
Sat Dec 23 21:47:12 PST 2023


================
@@ -300,5 +321,22 @@ func.func @entry() {
   call @test_element(%angle_test_cast, %angle_func)
     : (tensor<?xcomplex<f32>>, (complex<f32>) -> f32) -> ()
 
+  // complex.abs test
+  %abs_test = arith.constant dense<[
+    (1.0, 1.0),
+    // CHECK:  1.414
+    (1.0e300, 1.0e300),
+    // CHECK-NEXT:  1.41421e+300
+    (1.0e-300, 1.0e-300)
+    // CHECK-NEXT:  1.41421e-300
----------------
Lewuathe wrote:

The returned values are `inf` and 0 without this change.

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


More information about the Mlir-commits mailing list