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

Kai Sasaki llvmlistbot at llvm.org
Sun Jan 28 21:55:07 PST 2024


================
@@ -300,5 +321,32 @@ 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
+    (5.0, 0.0),
+    // CHECK-NEXT:  5
+    (0.0, 6.0),
+    // CHECK-NEXT:  6
+    (7.0, 8.0),
+    // CHECK-NEXT:  10.6301
+    (-1.0, -1.0),
----------------
Lewuathe wrote:

Add test case with the negative values. 

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


More information about the Mlir-commits mailing list