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]

alpha ev4 gcc.c-torture/execute/990811-1.c


This test was failing at -O3 because combine simplified

  (set (reg:DI 152)
       (ashift:DI (reg:DI 151)
		  (minus:DI (const_int 64 [0x40])
			    (ashift:DI (and:DI (plus (reg:DI FP)
						     (const_int 24))
					       (const_int 7 [0x7]))
				       (const_int 3 [0x3])))))

to zero.  It did this because FP+24 is known to be 8 byte aligned,
which simplifies to 

  (set (reg:DI 152)
       (ashift:DI (reg:DI 151)
		  (const_int 64 [0x40])))

which the hardware will treat as a simple move.  Combine, however,
was not minding SHIFT_COUNT_TRUNCATED in this instance, and happily
assumed that we'd shifted out all the important bits.

Fixed thus.


r~


	* combine.c (simplify_shift_const): Obey SHIFT_COUNT_TRUNCATED.

Index: combine.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/combine.c,v
retrieving revision 1.142
diff -c -p -d -r1.142 combine.c
*** combine.c	2000/08/04 20:28:04	1.142
--- combine.c	2000/08/11 07:29:01
*************** simplify_shift_const (x, code, result_mo
*** 8879,8888 ****
  	   ? result_mode : mode);
  
        /* Handle cases where the count is greater than the size of the mode
! 	 minus 1.  For ASHIFT, use the size minus one as the count (this can
! 	 occur when simplifying (lshiftrt (ashiftrt ..))).  For rotates,
! 	 take the count modulo the size.  For other shifts, the result is
! 	 zero.
  
  	 Since these shifts are being produced by the compiler by combining
  	 multiple operations, each of which are defined, we know what the
--- 8879,8889 ----
  	   ? result_mode : mode);
  
        /* Handle cases where the count is greater than the size of the mode
! 	 minus 1.  If SHIFT_COUNT_TRUNCATED, there aren't really any such
! 	 cases.  Otherwise, for ASHIFT, use the size minus one as the count
! 	 (this can occur when simplifying (lshiftrt (ashiftrt ..))).  For
! 	 rotates, take the count modulo the size.  For other shifts, the
! 	 result is zero.
  
  	 Since these shifts are being produced by the compiler by combining
  	 multiple operations, each of which are defined, we know what the
*************** simplify_shift_const (x, code, result_mo
*** 8890,8895 ****
--- 8891,8901 ----
  
        if (count > GET_MODE_BITSIZE (shift_mode) - 1)
  	{
+ #ifdef SHIFT_COUNT_TRUNCATED
+ 	  if (SHIFT_COUNT_TRUNCATED)
+ 	    count %= GET_MODE_BITSIZE (shift_mode);
+ 	  else
+ #endif
  	  if (code == ASHIFTRT)
  	    count = GET_MODE_BITSIZE (shift_mode) - 1;
  	  else if (code == ROTATE || code == ROTATERT)

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