This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] rs6000: Do not allow GPR0 for addic. if it is split
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: gcc-patches at gcc dot gnu dot org
- Cc: dje dot gcc at gmail dot com, Segher Boessenkool <segher at kernel dot crashing dot org>
- Date: Mon, 15 Dec 2014 03:11:58 -0800
- Subject: [PATCH] rs6000: Do not allow GPR0 for addic. if it is split
- Authentication-results: sourceware.org; auth=none
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 <segher@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