Commit 825bd25c by Aldy Hernandez

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
parent c24851de
......@@ -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));
......
typedef int __attribute__((vector_size(8))) v2si;
long long s64;
static inline long long
__ev_convert_s64 (v2si a)
{
return (long long) a;
}
int main()
{
s64 = __ev_convert_s64 ((v2si){1,0xffffffff});
if (s64 != 0x1ffffffffLL)
abort ();
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment