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]

3.4 fix for PR24950, ICE in operand_subword_force


Hi Gaby,
  In order to fix this PR on 3.4, I need to backport some other
patches.  Well, strictly speaking, rth's cleanup patch isn't really
necessary, but it's much nicer to keep the code like gcc-4 and not too
hard to verify that op0 is never a SUBREG so the "Severe Tire Damage"
can't happen.  powerpc64-linux bootstrap and regression test still in
progress.  OK to apply assuming all is well?

Index: gcc/ChangeLog
===================================================================
--- gcc/ChangeLog	(revision 107343)
+++ gcc/ChangeLog	(working copy)
@@ -1,3 +1,19 @@
+2005-11-22  Alan Modra  <amodra@bigpond.net.au>
+
+	PR middle-end/24950
+	* expmed.c (store_bit_field): Don't attempt to insv a field
+	larger than the reg.
+
+	Merge from trunk
+	2005-11-14  Dale Johannesen  <dalej@apple.com>
+	* expmed.c (store_bit_field):  Add offset unconditionally for
+	memory targets.
+	(extract_bit_field):  Don't force extzv or extv operand into
+	a register if field is too big.
+	2004-12-01  Richard Henderson  <rth@redhat.com>
+	* expmed.c (store_bit_field): Use simplify_gen_subreg instead
+	of gen_rtx_SUBREG directly.
+
 2005-11-16  Steve Ellcey  <sje@cup.hp.com>
 
 	PR target/24718
Index: gcc/expmed.c
===================================================================
--- gcc/expmed.c	(revision 107343)
+++ gcc/expmed.c	(working copy)
@@ -389,25 +389,11 @@ store_bit_field (rtx str_rtx, unsigned H
 	     || (offset * BITS_PER_UNIT % bitsize == 0
 		 && MEM_ALIGN (op0) % GET_MODE_BITSIZE (fieldmode) == 0))))
     {
-      if (GET_MODE (op0) != fieldmode)
-	{
-	  if (GET_CODE (op0) == SUBREG)
-	    {
-	      if (GET_MODE (SUBREG_REG (op0)) == fieldmode
-		  || GET_MODE_CLASS (fieldmode) == MODE_INT
-		  || GET_MODE_CLASS (fieldmode) == MODE_PARTIAL_INT)
-		op0 = SUBREG_REG (op0);
-	      else
-		/* Else we've got some float mode source being extracted into
-		   a different float mode destination -- this combination of
-		   subregs results in Severe Tire Damage.  */
-		abort ();
-	    }
-	  if (GET_CODE (op0) == REG)
-	    op0 = gen_rtx_SUBREG (fieldmode, op0, byte_offset);
-	  else
-	    op0 = adjust_address (op0, fieldmode, offset);
-	}
+      if (GET_CODE (op0) == MEM)
+	op0 = adjust_address (op0, fieldmode, offset);
+      else if (GET_MODE (op0) != fieldmode)
+	op0 = simplify_gen_subreg (fieldmode, op0, GET_MODE (op0),
+				   byte_offset);
       emit_move_insn (op0, value);
       return value;
     }
@@ -622,6 +608,7 @@ store_bit_field (rtx str_rtx, unsigned H
 	    bestmode = GET_MODE (op0);
 
 	  if (bestmode == VOIDmode
+	      || GET_MODE_SIZE (bestmode) < GET_MODE_SIZE (fieldmode)
 	      || (SLOW_UNALIGNED_ACCESS (bestmode, MEM_ALIGN (op0))
 		  && GET_MODE_BITSIZE (bestmode) > MEM_ALIGN (op0)))
 	    goto insv_loses;
@@ -1401,6 +1388,11 @@ extract_bit_field (rtx str_rtx, unsigned
 		  xbitpos = bitnum % unit;
 		  xop0 = adjust_address (xop0, bestmode, xoffset);
 
+		  /* Make sure register is big enough for the whole field. */
+		  if (xoffset * BITS_PER_UNIT + unit 
+		      < offset * BITS_PER_UNIT + bitsize)
+		    goto extzv_loses;
+
 		  /* Fetch it to a register in that size.  */
 		  xop0 = force_reg (bestmode, xop0);
 
@@ -1531,6 +1523,11 @@ extract_bit_field (rtx str_rtx, unsigned
 		  xbitpos = bitnum % unit;
 		  xop0 = adjust_address (xop0, bestmode, xoffset);
 
+		  /* Make sure register is big enough for the whole field. */
+		  if (xoffset * BITS_PER_UNIT + unit 
+		      < offset * BITS_PER_UNIT + bitsize)
+		    goto extv_loses;
+
 		  /* Fetch it to a register in that size.  */
 		  xop0 = force_reg (bestmode, xop0);
 
Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog	(revision 107343)
+++ gcc/testsuite/ChangeLog	(working copy)
@@ -1,3 +1,9 @@
+2005-11-22  Alan Modra  <amodra@bigpond.net.au>
+
+	PR middle-end/24950
+	Copy from trunk 2005-11-14  Dale Johannesen  <dalej@apple.com>
+	* gcc.c-torture/execute/20051113-1.c:  New.
+
 2005-11-16  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
 	PR c++/23797

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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