This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: patch: convert_move


Oh yeah, with appropriate testcase of course.

Tests pending.

2003-06-13 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/cvsfiles/devo/gcc/simplify-rtx.c,v
retrieving revision 1.46
diff -c -p -r1.46 simplify-rtx.c
*** simplify-rtx.c	2003/03/23 17:13:35	1.46
--- simplify-rtx.c	2003/06/13 17:14:37
*************** simplify_subreg (outermode, op, innermod
*** 2646,2652 ****
--- 2646,2656 ----
  	  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)
  	    {
  	      elt = CONST_VECTOR_ELT (op, i);
*************** simplify_subreg (outermode, op, innermod
*** 2664,2670 ****
  	      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));
--- 2668,2674 ----
  	      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: simd-4.c
diff -N simd-4.c
*** /dev/null	Thu Aug 24 02:00:32 2000
--- simd-4.c	Fri Jun 13 10:14:37 2003
***************
*** 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){0,0xffffffff});
+   if (s64 != 0xffffffff)
+     abort ();
+   return 0;
+ }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]