diff options
author | Richard Guenther <rguenther@suse.de> | 2008-01-16 16:00:17 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2008-01-16 16:00:17 +0000 |
commit | a1a5996d9ee2ae55dcc1c4e1bccb0dfb76a64caf (patch) | |
tree | 7b576b7515a8cd71afd71de1f0d38d04d85e48a0 /gcc/tree.c | |
parent | de4af523c5a6790873770f4d1248bedc4dd6e56a (diff) | |
download | gcc-a1a5996d9ee2ae55dcc1c4e1bccb0dfb76a64caf.zip gcc-a1a5996d9ee2ae55dcc1c4e1bccb0dfb76a64caf.tar.gz gcc-a1a5996d9ee2ae55dcc1c4e1bccb0dfb76a64caf.tar.bz2 |
re PR tree-optimization/34769 (gcc.dg/vect/no-vfa-pr29145.c)
2008-01-16 Richard Guenther <rguenther@suse.de>
PR tree-optimization/34769
* tree-data-ref.c (initialize_matrix_A): Revert fix for PR34458.
* tree.c (int_cst_value): Instead make this function more
permissive in what it accepts as valid input. Document this
function always sign-extends the value.
From-SVN: r131573
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 19 |
1 files changed, 12 insertions, 7 deletions
@@ -8036,21 +8036,26 @@ find_compatible_field (tree record, tree orig_field) return orig_field; } -/* Return value of a constant X. */ +/* Return value of a constant X and sign-extend it. */ HOST_WIDE_INT int_cst_value (const_tree x) { unsigned bits = TYPE_PRECISION (TREE_TYPE (x)); unsigned HOST_WIDE_INT val = TREE_INT_CST_LOW (x); - bool negative = ((val >> (bits - 1)) & 1) != 0; - gcc_assert (bits <= HOST_BITS_PER_WIDE_INT); + /* Make sure the sign-extended value will fit in a HOST_WIDE_INT. */ + gcc_assert (TREE_INT_CST_HIGH (x) == 0 + || TREE_INT_CST_HIGH (x) == -1); - if (negative) - val |= (~(unsigned HOST_WIDE_INT) 0) << (bits - 1) << 1; - else - val &= ~((~(unsigned HOST_WIDE_INT) 0) << (bits - 1) << 1); + if (bits < HOST_BITS_PER_WIDE_INT) + { + bool negative = ((val >> (bits - 1)) & 1) != 0; + if (negative) + val |= (~(unsigned HOST_WIDE_INT) 0) << (bits - 1) << 1; + else + val &= ~((~(unsigned HOST_WIDE_INT) 0) << (bits - 1) << 1); + } return val; } |