diff mbox

rs6000: Fix PR63195

Message ID 2a3f2464121a3a07bdc126c6a75b295ca46ea127.1410214670.git.segher@kernel.crashing.org
State New
Headers show

Commit Message

Segher Boessenkool Sept. 8, 2014, 10:41 p.m. UTC
When reload decides it needs to reload something that was assigned a
register before it will only look at the contraint, not the predicate.
This means that for the *bool<mode>3 I added with predicate logical_operand
(that is registers, and unsigned numbers that have only the low 16 or next
16 bits set) and contraint "r,n" it will put any integer constant in "n".
That won't work.  This patch splits the pattern in two, one for "r", one
for "n", solving the problem.  This is not a pessimisation because constant
propagation should already have taken care of any constants we *can* handle.

Also, this situation happens very rarely: nothing in the testsuite triggers
it, and a normal bootstrap doesn't either, but --enable-checking=release
did.  It seems it doesn't happen at all with LRA, or even more rarely.

Bootstrapped and tested on powerpc64-linux, m64,m32,m32/mpowerpc64,m64/mlra,
no regressions.  Also tested with --enable-checking=release, and that now
again bootstraps.

Okay for mainline?


Segher


2014-09-08  Segher Boessenkool  <segher@kernel.crashing.org>

	PR target/63195
	* config/rs6000/rs6000.md (*bool<mode>3): Allow only register
	operands.  Split off the constant operand alternative to ...
	(*bool<mode>3_imm): New.

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

Comments

David Edelsohn Sept. 9, 2014, 1:58 p.m. UTC | #1
On Mon, Sep 8, 2014 at 6:41 PM, Segher Boessenkool
<segher@kernel.crashing.org> wrote:
> When reload decides it needs to reload something that was assigned a
> register before it will only look at the contraint, not the predicate.
> This means that for the *bool<mode>3 I added with predicate logical_operand
> (that is registers, and unsigned numbers that have only the low 16 or next
> 16 bits set) and contraint "r,n" it will put any integer constant in "n".
> That won't work.  This patch splits the pattern in two, one for "r", one
> for "n", solving the problem.  This is not a pessimisation because constant
> propagation should already have taken care of any constants we *can* handle.
>
> Also, this situation happens very rarely: nothing in the testsuite triggers
> it, and a normal bootstrap doesn't either, but --enable-checking=release
> did.  It seems it doesn't happen at all with LRA, or even more rarely.
>
> Bootstrapped and tested on powerpc64-linux, m64,m32,m32/mpowerpc64,m64/mlra,
> no regressions.  Also tested with --enable-checking=release, and that now
> again bootstraps.
>
> Okay for mainline?
>
>
> Segher
>
>
> 2014-09-08  Segher Boessenkool  <segher@kernel.crashing.org>
>
>         PR target/63195
>         * config/rs6000/rs6000.md (*bool<mode>3): Allow only register
>         operands.  Split off the constant operand alternative to ...
>         (*bool<mode>3_imm): New.

Okay.

Thanks, David
diff mbox

Patch

diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index 2df8e41..b5aeaed 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -2996,14 +2996,21 @@  (define_expand "xor<mode>3"
 })
 
 (define_insn "*bool<mode>3"
-  [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
+  [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
 	(match_operator:GPR 3 "boolean_or_operator"
-	 [(match_operand:GPR 1 "gpc_reg_operand" "%r,r")
-	  (match_operand:GPR 2 "logical_operand" "r,n")]))]
+	 [(match_operand:GPR 1 "gpc_reg_operand" "r")
+	  (match_operand:GPR 2 "gpc_reg_operand" "r")]))]
   ""
-  "@
-   %q3 %0,%1,%2
-   %q3i%e2 %0,%1,%u2"
+  "%q3 %0,%1,%2"
+  [(set_attr "type" "logical")])
+
+(define_insn "*bool<mode>3_imm"
+  [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
+	(match_operator:GPR 3 "boolean_or_operator"
+	 [(match_operand:GPR 1 "gpc_reg_operand" "%r")
+	  (match_operand:GPR 2 "logical_const_operand" "n")]))]
+  ""
+  "%q3i%e2 %0,%1,%u2"
   [(set_attr "type" "logical")])
 
 (define_insn_and_split "*bool<mode>3_dot"