diff mbox

rs6000: Disparage CTR and LR in movcc_internal1

Message ID 2e84b9a3d2a12f46116328b6b449c4f361c9f3c9.1474935886.git.segher@kernel.crashing.org
State New
Headers show

Commit Message

Segher Boessenkool Sept. 27, 2016, 12:33 a.m. UTC
Hi!

LRA likes to use CTR and LR to store CCmode values.  Not such a good
idea.  All other similar patterns disparage using CTR and LR; do so
here, too.

Committing to trunk.


Segher


2016-09-27  Segher Boessenkool  <segher@kernel.crashing.org>

	* config/rs6000/rs6000.md (movcc_internal1): Disparage using CTR or LR.

---
 gcc/config/rs6000/rs6000.md | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Alan Modra Sept. 27, 2016, 4:59 a.m. UTC | #1
On Tue, Sep 27, 2016 at 12:33:59AM +0000, Segher Boessenkool wrote:
> 	* config/rs6000/rs6000.md (movcc_internal1): Disparage using CTR or LR.

Actually, not disparage, but ignore when choosing register
preferences.

>  (define_insn "*movcc_internal1"
> -  [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,y,r,r,r,r,r,cl,r,m")
> -	(match_operand:CC 1 "general_operand" "y,r,r,O,x,y,r,I,h,r,m,r"))]
> +  [(set (match_operand:CC 0 "nonimmediate_operand"
> +			    "=y,x,?y,y,r,r,r,r,r,*c*l,r,m")
> +	(match_operand:CC 1 "general_operand"
> +			    " y,r, r,O,x,y,r,I,h,   r,m,r"))]

What about that "h" lurking there?
Segher Boessenkool Sept. 27, 2016, 5:36 a.m. UTC | #2
On Tue, Sep 27, 2016 at 02:29:46PM +0930, Alan Modra wrote:
> On Tue, Sep 27, 2016 at 12:33:59AM +0000, Segher Boessenkool wrote:
> > 	* config/rs6000/rs6000.md (movcc_internal1): Disparage using CTR or LR.
> 
> Actually, not disparage, but ignore when choosing register
> preferences.

@cindex @samp{*} in constraint
@item *
Says that the following character should be ignored when choosing
register preferences.  @samp{*} has no effect on the meaning of the
constraint as a constraint, and no effect on reloading.  For LRA
@samp{*} additionally disparages slightly the alternative if the
following character matches the operand.

I should just have said "add *", much clearer :-)

> >  (define_insn "*movcc_internal1"
> > -  [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,y,r,r,r,r,r,cl,r,m")
> > -	(match_operand:CC 1 "general_operand" "y,r,r,O,x,y,r,I,h,r,m,r"))]
> > +  [(set (match_operand:CC 0 "nonimmediate_operand"
> > +			    "=y,x,?y,y,r,r,r,r,r,*c*l,r,m")
> > +	(match_operand:CC 1 "general_operand"
> > +			    " y,r, r,O,x,y,r,I,h,   r,m,r"))]
> 
> What about that "h" lurking there?

I haven't seen it do the wrong thing (yet).  There are various other mov
patterns that allow "h" as source like this, btw; if you want to change
it here, please see if you can change all?


Segher
diff mbox

Patch

diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index 7b995ac..a9fabc1 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -6653,8 +6653,10 @@  (define_expand "movcc"
   "")
 
 (define_insn "*movcc_internal1"
-  [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,y,r,r,r,r,r,cl,r,m")
-	(match_operand:CC 1 "general_operand" "y,r,r,O,x,y,r,I,h,r,m,r"))]
+  [(set (match_operand:CC 0 "nonimmediate_operand"
+			    "=y,x,?y,y,r,r,r,r,r,*c*l,r,m")
+	(match_operand:CC 1 "general_operand"
+			    " y,r, r,O,x,y,r,I,h,   r,m,r"))]
   "register_operand (operands[0], CCmode)
    || register_operand (operands[1], CCmode)"
   "@