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

Kai Sasaki llvmlistbot at llvm.org
Wed Feb 7 22:33:44 PST 2024


================
@@ -300,5 +321,36 @@ 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),
+    // CHECK-NEXT: 1.414
+    (-1.0e300, -1.0e300),
+    // CHECK-NEXT:  1.41421e+300
+    (-1.0, 0.0),
+    // CHECK-NEXT:  1
+    (0.0, -1.0)
+    // CHECK-NEXT:  1
----------------
Lewuathe wrote:

Add test case where the real is zero.

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


More information about the Mlir-commits mailing list