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]

Correct mode shrinkage of set destination by reload_cse_simplify_set


The enclosed patch corrects a FAIL observed in the testcase 921029.c
when built with "-O3 -fPIC" with hppa1.1 hpux10.20.  The mode for the
following insn shrinks from DImode to SImode in the postreload pass:

(set (reg/f:DI 24 %r24 [103])
     (mem/f:DI (reg/f:SI 20 %r20 [102]) 4))

to

(set (reg:SI 24 %r24 [103])
     (const_int 0 [0x0]))


I have added a check to test whether word_mode is wider than the current
destination mode.

Bootstrap checked under i686 linux and hpux 10.20.  OK to install branch
and main?

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

2001-03-08  John David Anglin  <dave@hiauly1.hia.nrc.ca>

	* reload1.c (reload_cse_simplify_set): Change insn destination to
	word_mode only if word_mode is wider than the original mode.

--- reload1.c.orig	Tue Mar  6 17:54:18 2001
+++ reload1.c	Thu Mar  8 14:21:20 2001
@@ -8274,9 +8274,13 @@
 	      && GET_CODE (SET_SRC (set)) != REG))
 	{
 #ifdef LOAD_EXTEND_OP
-	  rtx wide_dest = gen_rtx_REG (word_mode, REGNO (SET_DEST (set)));
-	  ORIGINAL_REGNO (wide_dest) = ORIGINAL_REGNO (SET_DEST (set));
-	  validate_change (insn, &SET_DEST (set), wide_dest, 1);
+	  if (GET_MODE_SIZE (word_mode)
+	      > GET_MODE_SIZE (GET_MODE (SET_DEST (set))))
+	    {
+	      rtx wide_dest = gen_rtx_REG (word_mode, REGNO (SET_DEST (set)));
+	      ORIGINAL_REGNO (wide_dest) = ORIGINAL_REGNO (SET_DEST (set));
+	      validate_change (insn, &SET_DEST (set), wide_dest, 1);
+	    }
 #endif
 
 	  validate_change (insn, &SET_SRC (set), copy_rtx (this_rtx), 1);


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