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: Don't create pseudos after no_new_pseudos on SH


On Tue, Nov 19, 2002 at 01:10:34PM +0000, Joern Rennecke wrote:
> Daniel Jacobowitz wrote:
> > 
> > On Mon, Nov 18, 2002 at 08:51:30PM +0000, Joern Rennecke wrote:
> > > It is not good practice to unnecessarily duplicate the test in
> > > zero_extendqisi2 in gen_shl_and .  Rather, zero_extendqisi2 and
> > > zero_extendhisi2 should FAIL; when they would need a new pseudo
> > > but can't have one, and this could be tested in gen_shl_and.
> > 
> > I didn't realize I could FAIL at that point.  Thanks, I knew there had
> > to be a better way.
> 
> Note that the rules are different for different patterns and different
> callers.  Move patterns should never FAIL when called by
> machine-independent code.  There are a number of named patterns that
> should not fail when called during initial rtl generation, while others
> may FAIL whenever they see fit.
> If a condition can only arise when some backend code invokes the pattern,
> you can code the handling of the FAIL in the caller when you put it into
> the callee pattern. 

That makes sense, thanks.

> > I'm not sure what you're talking about; what's "ashrdi3+3" refer to?
> > None of the ashrdi3* patterns are called at all in my testcase.
> 
> When a pattern has no name, it can be referred to by the previous named
> pattern and an offset that indicates how many patterns further down
> the md file the referred to pattern is.  I.e. ashrdi3+1 is the pattern
> just after ashrdi3.  This is also the notation used by the generater
> programs when they report error messages.
> 
> FWIW, I whish there was a way to give all patterns - including splitters -
> a name, so that we could do away with this fragile naming (these designations
> shift in meaning when you insert new patterns).

Uch, ditto.  Worse, you can't trivially search for these names.  It
would be nice to be able to add name labels for these splitters.

Is this patch what you had in mind?  I haven't regtested it (don't have
the build tree any more... it takes a long time to build all those
multilibs!) but it fixes my testcase.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

2002-11-19  Daniel Jacobowitz  <drow@mvista.com>

	* config/sh/sh.c (gen_shl_and): Revert previous patch.
	* config/sh/sh.md (ashrdi3+1, ashrdi3+2): Predicate on
	reload_completed.

Index: sh.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/sh.c,v
retrieving revision 1.182
diff -u -p -r1.182 sh.c
--- sh.c	18 Nov 2002 14:01:23 -0000	1.182
+++ sh.c	19 Nov 2002 17:50:47 -0000
@@ -1823,16 +1823,11 @@ gen_shl_and (dest, left_rtx, mask_rtx, s
 
 	if (first < 0)
 	  {
-	    enum machine_mode mode
-	      = ((mask << right) <= 0xff) ? QImode : HImode;
-	    rtx lowpart = gen_lowpart (mode, source);
-
-	    if (no_new_pseudos && ! TARGET_SHMEDIA
-		&& ! arith_reg_operand (lowpart, mode))
-	      return -1;
 	    emit_insn ((mask << right) <= 0xff
-		       ? gen_zero_extendqisi2(dest, lowpart)
-		       : gen_zero_extendhisi2(dest, lowpart));
+		       ? gen_zero_extendqisi2(dest,
+					      gen_lowpart (QImode, source))
+		       : gen_zero_extendhisi2(dest,
+					      gen_lowpart (HImode, source)));
 	    source = dest;
 	  }
 	if (source != dest)
@@ -1851,18 +1846,9 @@ gen_shl_and (dest, left_rtx, mask_rtx, s
 	    mask <<= first;
 	  }
 	if (first >= 0)
-	  {
-	    enum machine_mode mode = (mask <= 0xff) ? QImode : HImode;
-	    rtx lowpart = gen_lowpart (mode, dest);
-
-	    if (no_new_pseudos && ! TARGET_SHMEDIA
-		&& ! arith_reg_operand (lowpart, mode))
-	      return -1;
-	    emit_insn (mask <= 0xff
-		       ? gen_zero_extendqisi2(dest, lowpart)
-		       : gen_zero_extendhisi2(dest, lowpart));
-	  }
-	
+	  emit_insn (mask <= 0xff
+		     ? gen_zero_extendqisi2(dest, gen_lowpart (QImode, dest))
+		     : gen_zero_extendhisi2(dest, gen_lowpart (HImode, dest)));
 	if (total_shift > 0)
 	  {
 	    operands[2] = GEN_INT (total_shift);
Index: sh.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/sh.md,v
retrieving revision 1.127
diff -u -p -r1.127 sh.md
--- sh.md	18 Nov 2002 14:01:23 -0000	1.127
+++ sh.md	19 Nov 2002 17:50:55 -0000
@@ -2694,7 +2694,7 @@
 	(and:SI (ashift:SI (match_operand:SI 1 "register_operand" "")
 			   (match_operand:SI 2 "const_int_operand" ""))
 		(match_operand:SI 3 "const_int_operand" "")))]
-  "TARGET_SH1 && (unsigned)INTVAL (operands[2]) < 32"
+  "TARGET_SH1 && reload_completed && (unsigned)INTVAL (operands[2]) < 32"
   [(use (reg:SI R0_REG))]
   "if (gen_shl_and (operands[0], operands[2], operands[3], operands[1])) FAIL;
    DONE;")
@@ -2705,7 +2705,7 @@
 			   (match_operand:SI 2 "const_int_operand" ""))
 		(match_operand:SI 3 "const_int_operand" "")))
    (clobber (reg:SI T_REG))]
-  "TARGET_SH1 && (unsigned)INTVAL (operands[2]) < 32"
+  "TARGET_SH1 && reload_completed && (unsigned)INTVAL (operands[2]) < 32"
   [(use (reg:SI R0_REG))]
   "if (gen_shl_and (operands[0], operands[2], operands[3], operands[1])) FAIL;
    DONE;")


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