Hi!

Apparently on arm we force -ffast-math in gcc.dg/vect/ but that changes
behavior, as we don't want to insert with -ffinite-math-only infinities
when the user didn't use them, for exclusive scan we get -__FLT_MAX__
in the first element rather than -inf.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
committed to trunk.

I wonder whether we for -ffast-math shouldn't fold say MAX_EXPR
(-__FLT_MAX__, x) into x etc. (in particular if we don't HONOR_INFINITIES
as well as don't care about NaNs).

2019-07-06  Jakub Jelinek  <ja...@redhat.com>

        PR tree-optimization/91096
        * gcc.dg/vect/vect-simd-10.c (FLT_MIN_VALUE): Define.
        (bar, main): Use it instead of -__builtin_inff ().
        * gcc.dg/vect/vect-simd-14.c (FLT_MIN_VALUE): Define.
        (bar, main): Use it instead of -__builtin_inff ().

--- gcc/testsuite/gcc.dg/vect/vect-simd-10.c.jj 2019-06-19 11:58:53.164238382 
+0200
+++ gcc/testsuite/gcc.dg/vect/vect-simd-10.c    2019-07-05 17:30:29.617292809 
+0200
@@ -7,6 +7,12 @@
 #include "tree-vect.h"
 #endif
 
+#ifdef __FAST_MATH__
+#define FLT_MIN_VALUE (-__FLT_MAX__)
+#else
+#define FLT_MIN_VALUE (-__builtin_inff ())
+#endif
+
 float r = 1.0f, a[1024], b[1024];
 
 __attribute__((noipa)) void
@@ -24,7 +30,7 @@ foo (float *a, float *b)
 __attribute__((noipa)) float
 bar (void)
 {
-  float s = -__builtin_inff ();
+  float s = FLT_MIN_VALUE;
   #pragma omp simd reduction (inscan, max:s)
   for (int i = 0; i < 1024; i++)
     {
@@ -84,7 +90,7 @@ main ()
     }
   if (bar () != 592.0f)
     abort ();
-  s = -__builtin_inff ();
+  s = FLT_MIN_VALUE;
   for (int i = 0; i < 1024; ++i)
     {
       if (s < a[i])
--- gcc/testsuite/gcc.dg/vect/vect-simd-14.c.jj 2019-06-21 08:47:04.175673252 
+0200
+++ gcc/testsuite/gcc.dg/vect/vect-simd-14.c    2019-07-05 17:30:47.455011270 
+0200
@@ -7,6 +7,12 @@
 #include "tree-vect.h"
 #endif
 
+#ifdef __FAST_MATH__
+#define FLT_MIN_VALUE (-__FLT_MAX__)
+#else
+#define FLT_MIN_VALUE (-__builtin_inff ())
+#endif
+
 float r = 1.0f, a[1024], b[1024];
 
 __attribute__((noipa)) void
@@ -24,7 +30,7 @@ foo (float *a, float *b)
 __attribute__((noipa)) float
 bar (void)
 {
-  float s = -__builtin_inff ();
+  float s = FLT_MIN_VALUE;
   #pragma omp simd reduction (inscan, max:s)
   for (int i = 0; i < 1024; i++)
     {
@@ -82,7 +88,7 @@ main ()
     }
   if (bar () != 592.0f)
     abort ();
-  s = -__builtin_inff ();
+  s = FLT_MIN_VALUE;
   for (int i = 0; i < 1024; ++i)
     {
       if (b[i] != s)

        Jakub

Reply via email to