diff options
author | Aldy Hernandez <aldyh@gcc.gnu.org> | 2003-06-17 00:03:24 +0000 |
---|---|---|
committer | Aldy Hernandez <aldyh@gcc.gnu.org> | 2003-06-17 00:03:24 +0000 |
commit | 825bd25cb621ed2f6c88ff32c8604372de61dc4f (patch) | |
tree | 74fd80ca70747089c5d2d3c9bfaffdbd0a52e6fb /gcc/simplify-rtx.c | |
parent | c24851dee56337fd1d88a87749792980cf0d30bc (diff) | |
download | gcc-825bd25cb621ed2f6c88ff32c8604372de61dc4f.zip gcc-825bd25cb621ed2f6c88ff32c8604372de61dc4f.tar.gz gcc-825bd25cb621ed2f6c88ff32c8604372de61dc4f.tar.bz2 |
simplify-rtx.c (simplify_subreg): Do not over-extend vector constants.
2003-06-16 Aldy Hernandez <aldyh@redhat.com>
* simplify-rtx.c (simplify_subreg): Do not over-extend vector
constants.
* testsuite/gcc.c-torture/execute/simd-4.c: New.
[[Split portion of a mixed commit.]]
From-SVN: r68047.2
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r-- | gcc/simplify-rtx.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index cf68244..132b3ab 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -2657,6 +2657,10 @@ simplify_subreg (outermode, op, innermode, byte) unsigned i = BYTES_BIG_ENDIAN ? offset : offset + n_elts - 1; unsigned step = BYTES_BIG_ENDIAN ? 1 : -1; int shift = BITS_PER_UNIT * elt_size; + unsigned HOST_WIDE_INT unit_mask; + + unit_mask = (unsigned HOST_WIDE_INT) -1 + >> (sizeof (HOST_WIDE_INT) * BITS_PER_UNIT - shift); for (; n_elts--; i += step) { @@ -2675,7 +2679,7 @@ simplify_subreg (outermode, op, innermode, byte) if (high >> (HOST_BITS_PER_WIDE_INT - shift)) return NULL_RTX; high = high << shift | sum >> (HOST_BITS_PER_WIDE_INT - shift); - sum = (sum << shift) + INTVAL (elt); + sum = (sum << shift) + (INTVAL (elt) & unit_mask); } if (GET_MODE_BITSIZE (outermode) <= HOST_BITS_PER_WIDE_INT) return GEN_INT (trunc_int_for_mode (sum, outermode)); |