From: Jakub Jelinek Date: Tue, 30 May 2017 07:13:36 +0000 (+0200) Subject: backport: re PR tree-optimization/72824 (Signed floating point zero semantics broken... X-Git-Tag: releases/gcc-5.5.0~311 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=39ebb5bb57373844e2bd3548729b2b440c9c18b8;p=thirdparty%2Fgcc.git backport: re PR tree-optimization/72824 (Signed floating point zero semantics broken at optimization level -O3 (tree-loop-distribute-patterns)) Backported from mainline 2016-08-15 Martin Liska Jakub Jelinek PR tree-optimization/72824 * tree-loop-distribution.c (const_with_all_bytes_same) : Fix a typo. * gcc.c-torture/execute/ieee/pr72824-2.c: New test. From-SVN: r248597 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index afc11fa2bf01..c6c4f53f734f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,13 @@ 2017-05-30 Jakub Jelinek Backported from mainline + 2016-08-15 Martin Liska + Jakub Jelinek + + PR tree-optimization/72824 + * tree-loop-distribution.c (const_with_all_bytes_same) + : Fix a typo. + 2016-08-09 Jakub Jelinek PR tree-optimization/72824 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4f031a919ad2..2cfd28cf1e4c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ 2017-05-30 Jakub Jelinek Backported from mainline + 2016-08-15 Jakub Jelinek + + PR tree-optimization/72824 + * gcc.c-torture/execute/ieee/pr72824-2.c: New test. + 2016-08-12 Jakub Jelinek PR c/67410 diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/pr72824-2.c b/gcc/testsuite/gcc.c-torture/execute/ieee/pr72824-2.c new file mode 100644 index 000000000000..0622d01d21bf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/pr72824-2.c @@ -0,0 +1,21 @@ +/* PR tree-optimization/72824 */ + +typedef float V __attribute__((vector_size (4 * sizeof (float)))); + +static inline void +foo (V *x, V value) +{ + int i; + for (i = 0; i < 32; ++i) + x[i] = value; +} + +int +main () +{ + V x[32]; + foo (x, (V) { 0.f, -0.f, 0.f, -0.f }); + if (__builtin_copysignf (1.0, x[3][1]) != -1.0f) + __builtin_abort (); + return 0; +} diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c index e5e4d3c4e1a9..5c15f1924f83 100644 --- a/gcc/tree-loop-distribution.c +++ b/gcc/tree-loop-distribution.c @@ -800,7 +800,7 @@ const_with_all_bytes_same (tree val) case VECTOR_CST: unsigned int j; for (j = 0; j < VECTOR_CST_NELTS (val); ++j) - if (const_with_all_bytes_same (VECTOR_CST_ELT (val, i))) + if (const_with_all_bytes_same (VECTOR_CST_ELT (val, j))) break; if (j == VECTOR_CST_NELTS (val)) return 0;