If an addic. is split to addi+cmp (because RA didn't give it CR0), it will
do the wrong thing if the input reg is GPR0 ("addi X,0,N" is "li X,N").
So don't allow such an input.

Spotted visually while investigating PR64268.  Tested etc.; okay for
mainline?


Segher


2014-12-15  Segher Boessenkool  <seg...@kernel.crashing.org>

gcc/
        * gcc/config/rs6000/rs6000.md (*add>mode>3_imm_dot,
        *add<mode>3_imm_dot2): Change the constraint for the second
        alternative for operand 1 from "r" to "b".

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

diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index bb9ab0f..36e6182 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -1569,7 +1569,7 @@ (define_insn_and_split "*add<mode>3_dot2"
 
 (define_insn_and_split "*add<mode>3_imm_dot"
   [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
-       (compare:CC (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,r")
+       (compare:CC (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,b")
                              (match_operand:GPR 2 "short_cint_operand" "I,I"))
                    (const_int 0)))
    (clobber (match_scratch:GPR 0 "=r,r"))
@@ -1592,7 +1592,7 @@ (define_insn_and_split "*add<mode>3_imm_dot"
 
 (define_insn_and_split "*add<mode>3_imm_dot2"
   [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
-       (compare:CC (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,r")
+       (compare:CC (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,b")
                              (match_operand:GPR 2 "short_cint_operand" "I,I"))
                    (const_int 0)))
    (set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
-- 
1.8.1.4

Reply via email to