diff options
author | Thomas Preud'homme <thomas.preudhomme@arm.com> | 2014-03-12 10:15:29 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2014-03-12 11:15:29 +0100 |
commit | 882a5fbe3c0e81734257bfd8bc0f5c41a769394b (patch) | |
tree | 9b02b5390b8965759e4404532019e9f29d128bf4 /gcc/tree-ssa-math-opts.c | |
parent | a3cd024676cbf385396d57b6b1f752040a902779 (diff) | |
download | gcc-882a5fbe3c0e81734257bfd8bc0f5c41a769394b.zip gcc-882a5fbe3c0e81734257bfd8bc0f5c41a769394b.tar.gz gcc-882a5fbe3c0e81734257bfd8bc0f5c41a769394b.tar.bz2 |
re PR tree-optimization/60454 (Code mistakenly detected as doing bswap)
PR tree-optimization/60454
* tree-ssa-math-opts.c (find_bswap_1): Fix bswap detection.
* gcc.c-torture/execute/pr60454.c: New test.
From-SVN: r208509
Diffstat (limited to 'gcc/tree-ssa-math-opts.c')
-rw-r--r-- | gcc/tree-ssa-math-opts.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c index 8e372ed..9ff857c 100644 --- a/gcc/tree-ssa-math-opts.c +++ b/gcc/tree-ssa-math-opts.c @@ -1801,7 +1801,9 @@ find_bswap_1 (gimple stmt, struct symbolic_number *n, int limit) if (rhs_class == GIMPLE_BINARY_RHS) { + int i; struct symbolic_number n1, n2; + unsigned HOST_WIDEST_INT mask; tree source_expr2; if (code != BIT_IOR_EXPR) @@ -1827,6 +1829,15 @@ find_bswap_1 (gimple stmt, struct symbolic_number *n, int limit) return NULL_TREE; n->size = n1.size; + for (i = 0, mask = 0xff; i < n->size; i++, mask <<= BITS_PER_UNIT) + { + unsigned HOST_WIDEST_INT masked1, masked2; + + masked1 = n1.n & mask; + masked2 = n2.n & mask; + if (masked1 && masked2 && masked1 != masked2) + return NULL_TREE; + } n->n = n1.n | n2.n; if (!verify_symbolic_number_p (n, stmt)) |