From 5d1212877acd3f7a2a6ff23f91dc1a0ed106fdd4 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Sat, 6 Jul 2019 09:50:44 +0200 Subject: [PATCH] re PR tree-optimization/91096 (Openmp vector max reduction incorrect) 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 (). From-SVN: r273156 --- gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gcc.dg/vect/vect-simd-10.c | 10 ++++++++-- gcc/testsuite/gcc.dg/vect/vect-simd-14.c | 10 ++++++++-- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 33645b1f053..5a848eb77ec 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-07-06 Jakub Jelinek + + 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 (). + 2019-07-05 Paolo Carlini PR c++/67184 (again) diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-10.c b/gcc/testsuite/gcc.dg/vect/vect-simd-10.c index d442d6b3bd4..e49566a3847 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-simd-10.c +++ b/gcc/testsuite/gcc.dg/vect/vect-simd-10.c @@ -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]) diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-14.c b/gcc/testsuite/gcc.dg/vect/vect-simd-14.c index 43663bbc598..9e73792ed7c 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-simd-14.c +++ b/gcc/testsuite/gcc.dg/vect/vect-simd-14.c @@ -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) -- 2.30.2