[compiler-rt] [compiler-rt][builtins]Fix complex division for aarch64 (PR #106664)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 5 12:26:11 PDT 2024


================
@@ -190,174 +190,168 @@ int test__divsc3(float a, float b, float c, float d)
     return 0;
 }
 
-float x[][2] =
-{
-    { 1.e-6,  1.e-6},
-    {-1.e-6,  1.e-6},
-    {-1.e-6, -1.e-6},
-    { 1.e-6, -1.e-6},
-
-    { 1.e+6,  1.e-6},
-    {-1.e+6,  1.e-6},
-    {-1.e+6, -1.e-6},
-    { 1.e+6, -1.e-6},
+int main() {
+  float x[][2] = {{1.e-6, 1.e-6},
+                  {-1.e-6, 1.e-6},
+                  {-1.e-6, -1.e-6},
+                  {1.e-6, -1.e-6},
 
-    { 1.e-6,  1.e+6},
-    {-1.e-6,  1.e+6},
-    {-1.e-6, -1.e+6},
-    { 1.e-6, -1.e+6},
+                  {1.e+6, 1.e-6},
+                  {-1.e+6, 1.e-6},
+                  {-1.e+6, -1.e-6},
+                  {1.e+6, -1.e-6},
 
-    { 1.e+6,  1.e+6},
-    {-1.e+6,  1.e+6},
-    {-1.e+6, -1.e+6},
-    { 1.e+6, -1.e+6},
+                  {1.e-6, 1.e+6},
+                  {-1.e-6, 1.e+6},
+                  {-1.e-6, -1.e+6},
+                  {1.e-6, -1.e+6},
 
-    {NAN, NAN},
-    {-INFINITY, NAN},
-    {-2, NAN},
-    {-1, NAN},
-    {-0.5, NAN},
-    {-0., NAN},
-    {+0., NAN},
-    {0.5, NAN},
-    {1, NAN},
-    {2, NAN},
-    {INFINITY, NAN},
+                  {1.e+6, 1.e+6},
+                  {-1.e+6, 1.e+6},
+                  {-1.e+6, -1.e+6},
+                  {1.e+6, -1.e+6},
 
-    {NAN, -INFINITY},
-    {-INFINITY, -INFINITY},
-    {-2, -INFINITY},
-    {-1, -INFINITY},
-    {-0.5, -INFINITY},
-    {-0., -INFINITY},
-    {+0., -INFINITY},
-    {0.5, -INFINITY},
-    {1, -INFINITY},
-    {2, -INFINITY},
-    {INFINITY, -INFINITY},
+                  {NAN, NAN},
+                  {-INFINITY, NAN},
+                  {-2, NAN},
+                  {-1, NAN},
+                  {-0.5, NAN},
+                  {-0., NAN},
+                  {+0., NAN},
+                  {0.5, NAN},
+                  {1, NAN},
+                  {2, NAN},
+                  {INFINITY, NAN},
 
-    {NAN, -2},
-    {-INFINITY, -2},
-    {-2, -2},
-    {-1, -2},
-    {-0.5, -2},
-    {-0., -2},
-    {+0., -2},
-    {0.5, -2},
-    {1, -2},
-    {2, -2},
-    {INFINITY, -2},
+                  {NAN, -INFINITY},
+                  {-INFINITY, -INFINITY},
+                  {-2, -INFINITY},
+                  {-1, -INFINITY},
+                  {-0.5, -INFINITY},
+                  {-0., -INFINITY},
+                  {+0., -INFINITY},
+                  {0.5, -INFINITY},
+                  {1, -INFINITY},
+                  {2, -INFINITY},
+                  {INFINITY, -INFINITY},
 
-    {NAN, -1},
-    {-INFINITY, -1},
-    {-2, -1},
-    {-1, -1},
-    {-0.5, -1},
-    {-0., -1},
-    {+0., -1},
-    {0.5, -1},
-    {1, -1},
-    {2, -1},
-    {INFINITY, -1},
+                  {NAN, -2},
+                  {-INFINITY, -2},
+                  {-2, -2},
+                  {-1, -2},
+                  {-0.5, -2},
+                  {-0., -2},
+                  {+0., -2},
+                  {0.5, -2},
+                  {1, -2},
+                  {2, -2},
+                  {INFINITY, -2},
 
-    {NAN, -0.5},
-    {-INFINITY, -0.5},
-    {-2, -0.5},
-    {-1, -0.5},
-    {-0.5, -0.5},
-    {-0., -0.5},
-    {+0., -0.5},
-    {0.5, -0.5},
-    {1, -0.5},
-    {2, -0.5},
-    {INFINITY, -0.5},
+                  {NAN, -1},
+                  {-INFINITY, -1},
+                  {-2, -1},
+                  {-1, -1},
+                  {-0.5, -1},
+                  {-0., -1},
+                  {+0., -1},
+                  {0.5, -1},
+                  {1, -1},
+                  {2, -1},
+                  {INFINITY, -1},
 
-    {NAN, -0.},
-    {-INFINITY, -0.},
-    {-2, -0.},
-    {-1, -0.},
-    {-0.5, -0.},
-    {-0., -0.},
-    {+0., -0.},
-    {0.5, -0.},
-    {1, -0.},
-    {2, -0.},
-    {INFINITY, -0.},
+                  {NAN, -0.5},
+                  {-INFINITY, -0.5},
+                  {-2, -0.5},
+                  {-1, -0.5},
+                  {-0.5, -0.5},
+                  {-0., -0.5},
+                  {+0., -0.5},
+                  {0.5, -0.5},
+                  {1, -0.5},
+                  {2, -0.5},
+                  {INFINITY, -0.5},
 
-    {NAN, 0.},
-    {-INFINITY, 0.},
-    {-2, 0.},
-    {-1, 0.},
-    {-0.5, 0.},
-    {-0., 0.},
-    {+0., 0.},
-    {0.5, 0.},
-    {1, 0.},
-    {2, 0.},
-    {INFINITY, 0.},
+                  {NAN, -0.},
+                  {-INFINITY, -0.},
+                  {-2, -0.},
+                  {-1, -0.},
+                  {-0.5, -0.},
+                  {-0., -0.},
+                  {+0., -0.},
+                  {0.5, -0.},
+                  {1, -0.},
+                  {2, -0.},
+                  {INFINITY, -0.},
 
-    {NAN, 0.5},
-    {-INFINITY, 0.5},
-    {-2, 0.5},
-    {-1, 0.5},
-    {-0.5, 0.5},
-    {-0., 0.5},
-    {+0., 0.5},
-    {0.5, 0.5},
-    {1, 0.5},
-    {2, 0.5},
-    {INFINITY, 0.5},
+                  {NAN, 0.},
+                  {-INFINITY, 0.},
+                  {-2, 0.},
+                  {-1, 0.},
+                  {-0.5, 0.},
+                  {-0., 0.},
+                  {+0., 0.},
+                  {0.5, 0.},
+                  {1, 0.},
+                  {2, 0.},
+                  {INFINITY, 0.},
 
-    {NAN, 1},
-    {-INFINITY, 1},
-    {-2, 1},
-    {-1, 1},
-    {-0.5, 1},
-    {-0., 1},
-    {+0., 1},
-    {0.5, 1},
-    {1, 1},
-    {2, 1},
-    {INFINITY, 1},
+                  {NAN, 0.5},
+                  {-INFINITY, 0.5},
+                  {-2, 0.5},
+                  {-1, 0.5},
+                  {-0.5, 0.5},
+                  {-0., 0.5},
+                  {+0., 0.5},
+                  {0.5, 0.5},
+                  {1, 0.5},
+                  {2, 0.5},
+                  {INFINITY, 0.5},
 
-    {NAN, 2},
-    {-INFINITY, 2},
-    {-2, 2},
-    {-1, 2},
-    {-0.5, 2},
-    {-0., 2},
-    {+0., 2},
-    {0.5, 2},
-    {1, 2},
-    {2, 2},
-    {INFINITY, 2},
+                  {NAN, 1},
+                  {-INFINITY, 1},
+                  {-2, 1},
+                  {-1, 1},
+                  {-0.5, 1},
+                  {-0., 1},
+                  {+0., 1},
+                  {0.5, 1},
+                  {1, 1},
+                  {2, 1},
+                  {INFINITY, 1},
 
-    {NAN, INFINITY},
-    {-INFINITY, INFINITY},
-    {-2, INFINITY},
-    {-1, INFINITY},
-    {-0.5, INFINITY},
-    {-0., INFINITY},
-    {+0., INFINITY},
-    {0.5, INFINITY},
-    {1, INFINITY},
-    {2, INFINITY},
-    {INFINITY, INFINITY}
+                  {NAN, 2},
+                  {-INFINITY, 2},
+                  {-2, 2},
+                  {-1, 2},
+                  {-0.5, 2},
+                  {-0., 2},
+                  {+0., 2},
+                  {0.5, 2},
+                  {1, 2},
+                  {2, 2},
+                  {INFINITY, 2},
 
-};
+                  {NAN, INFINITY},
+                  {-INFINITY, INFINITY},
+                  {-2, INFINITY},
+                  {-1, INFINITY},
+                  {-0.5, INFINITY},
+                  {-0., INFINITY},
+                  {+0., INFINITY},
+                  {0.5, INFINITY},
+                  {1, INFINITY},
+                  {2, INFINITY},
+                  {INFINITY, INFINITY},
+                  {INFINITY, fromRep32(0x7f800001) /* NaN */}};
----------------
efriedma-quic wrote:

Please explicitly note this is SNaN.

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


More information about the llvm-commits mailing list