patch: convert_move
Aldy Hernandez
aldyh@redhat.com
Tue Jun 17 00:23:00 GMT 2003
Rth said it was OK with an updated test, and the parentheses bug
fixed.
Committed to mainline and e500 branch.
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.
Index: simplify-rtx.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/simplify-rtx.c,v
retrieving revision 1.143
diff -c -p -r1.143 simplify-rtx.c
*** simplify-rtx.c 16 Jun 2003 20:56:20 -0000 1.143
--- simplify-rtx.c 16 Jun 2003 23:59:11 -0000
*************** simplify_subreg (outermode, op, innermod
*** 2657,2662 ****
--- 2657,2666 ----
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)
{
*************** simplify_subreg (outermode, op, innermod
*** 2675,2681 ****
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);
}
if (GET_MODE_BITSIZE (outermode) <= HOST_BITS_PER_WIDE_INT)
return GEN_INT (trunc_int_for_mode (sum, outermode));
--- 2679,2685 ----
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) & unit_mask);
}
if (GET_MODE_BITSIZE (outermode) <= HOST_BITS_PER_WIDE_INT)
return GEN_INT (trunc_int_for_mode (sum, outermode));
Index: testsuite/gcc.c-torture/execute/simd-4.c
===================================================================
RCS file: testsuite/gcc.c-torture/execute/simd-4.c
diff -N testsuite/gcc.c-torture/execute/simd-4.c
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- testsuite/gcc.c-torture/execute/simd-4.c 16 Jun 2003 23:59:11 -0000
***************
*** 0 ****
--- 1,16 ----
+ 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;
+ }
More information about the Gcc-patches
mailing list