[PATCH] rs6000: Fix PR67346

2015-08-25 Thread Segher Boessenkool
*iormode_mask is a define_insn_and_split, so it shouldn't use
can_create_pseudo in its instruction condition, because IRA can then
create such an instruction, and the condition becomes false before
the insn is split.  Use a scratch instead.

Bootstrapped and tested on powerpc64-linux; okay for trunk?


Segher


2015-08-25  Segher Boessenkool  seg...@kernel.crashing.org

PR target/67346
* config/rs6000/rs6000.md (*iormode_mask): Use a match_scratch.

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

diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index 2138184..1710b5e 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -3652,9 +3652,9 @@ (define_split
 (define_insn_and_split *iormode_mask
   [(set (match_operand:GPR 0 gpc_reg_operand =r)
(ior:GPR (match_operand:GPR 1 gpc_reg_operand r)
-(match_operand:GPR 2 const_int_operand n)))]
-  can_create_pseudo_p ()
-!logical_const_operand (operands[2], MODEmode)
+(match_operand:GPR 2 const_int_operand n)))
+   (clobber (match_scratch:GPR 3 =r))]
+  !logical_const_operand (operands[2], MODEmode)
 rs6000_is_valid_mask (operands[2], NULL, NULL, MODEmode)
   #
1
@@ -3669,7 +3669,8 @@ (define_insn_and_split *iormode_mask
 {
   int nb, ne;
   rs6000_is_valid_mask (operands[2], nb, ne, MODEmode);
-  operands[3] = gen_reg_rtx (MODEmode);
+  if (GET_CODE (operands[3]) == SCRATCH)
+operands[3] = gen_reg_rtx (MODEmode);
   operands[4] = GEN_INT (ne);
   operands[5] = GEN_INT (~UINTVAL (operands[2]));
 }
-- 
1.8.1.4



Re: [PATCH] rs6000: Fix PR67346

2015-08-25 Thread David Edelsohn
On Tue, Aug 25, 2015 at 1:09 PM, Segher Boessenkool
seg...@kernel.crashing.org wrote:
 *iormode_mask is a define_insn_and_split, so it shouldn't use
 can_create_pseudo in its instruction condition, because IRA can then
 create such an instruction, and the condition becomes false before
 the insn is split.  Use a scratch instead.

 Bootstrapped and tested on powerpc64-linux; okay for trunk?


 Segher


 2015-08-25  Segher Boessenkool  seg...@kernel.crashing.org

 PR target/67346
 * config/rs6000/rs6000.md (*iormode_mask): Use a match_scratch.

Okay.

Thanks, David