summaryrefslogtreecommitdiff
path: root/gcc/tree-loop-distribution.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2016-08-09 07:49:14 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2016-08-09 07:49:14 +0000
commit53e7aca16e36342638b51cd6f319919bfe83d2a9 (patch)
treef9c8a787b868065680fcf3982a8ae8846c37d368 /gcc/tree-loop-distribution.c
parentc162fa25a00935c85a0411edec6159e443baf989 (diff)
downloadgcc-53e7aca16e36342638b51cd6f319919bfe83d2a9.tar.gz
PR tree-optimization/72824
* tree-loop-distribution.c (const_with_all_bytes_same): Verify real_zerop is not negative. * gcc.c-torture/execute/ieee/pr72824.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@239275 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-loop-distribution.c')
-rw-r--r--gcc/tree-loop-distribution.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index 181e4e9ed7d..342b9647fe7 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -750,12 +750,40 @@ const_with_all_bytes_same (tree val)
int i, len;
if (integer_zerop (val)
- || real_zerop (val)
|| (TREE_CODE (val) == CONSTRUCTOR
&& !TREE_CLOBBER_P (val)
&& CONSTRUCTOR_NELTS (val) == 0))
return 0;
+ if (real_zerop (val))
+ {
+ /* Only return 0 for +0.0, not for -0.0, which doesn't have
+ an all bytes same memory representation. Don't transform
+ -0.0 stores into +0.0 even for !HONOR_SIGNED_ZEROS. */
+ switch (TREE_CODE (val))
+ {
+ case REAL_CST:
+ if (!real_isneg (TREE_REAL_CST_PTR (val)))
+ return 0;
+ break;
+ case COMPLEX_CST:
+ if (!const_with_all_bytes_same (TREE_REALPART (val))
+ && !const_with_all_bytes_same (TREE_IMAGPART (val)))
+ return 0;
+ break;
+ 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)))
+ break;
+ if (j == VECTOR_CST_NELTS (val))
+ return 0;
+ break;
+ default:
+ break;
+ }
+ }
+
if (CHAR_BIT != 8 || BITS_PER_UNIT != 8)
return -1;