This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] rs6000: Fix peephole

This peephole transforms

  lis a,HI ; ori a,a,LO
  cmpw c,a,b ; beq c,...


  xoris a,b,HI1
  cmpwi c,a,LO1 ; beq c,...

when a and c are dead after this.  But it forgets to check that a and b
are not the same reg, generating non-sensical code.  This patch fixes that.

Tested etc.; is this okay for trunk?

(This peephole caused some FAILs in the testsuite after an unrelated change;
gone after this patch).


2015-05-08  Segher Boessenkool  <>

	* config/rs6000/ Require operand inequality in one
	of the peepholes.

 gcc/config/rs6000/ | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/config/rs6000/ b/gcc/config/rs6000/
index 0178bf4..463bd3c 100644
--- a/gcc/config/rs6000/
+++ b/gcc/config/rs6000/
@@ -11954,7 +11954,8 @@ (define_peephole2
                       (match_operand 7 "" "")
                       (match_operand 8 "" "")))]
   "peep2_reg_dead_p (3, operands[0])
-   && peep2_reg_dead_p (4, operands[4])"
+   && peep2_reg_dead_p (4, operands[4])
+   && REGNO (operands[0]) != REGNO (operands[5])"
  [(set (match_dup 0) (xor:SI (match_dup 5) (match_dup 9)))
   (set (match_dup 4) (compare:CC (match_dup 0) (match_dup 10)))
   (set (pc) (if_then_else (match_dup 6) (match_dup 7) (match_dup 8)))]

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]