diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f24e24052a7..d4522513a73 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2002-04-02 David S. Miller + + * config/sparc/sparc.md (ldd peephole2s): Fix final arg to + mems_ok_for_ldd_peep when the order of the loads being examined + is reversed. + * config/sparc/sparc.c (mems_ok_for_ldd_peep): Expand upon + existing comment to increase comprehension of this situation. + 2002-04-02 Zack Weinberg * config/sh/sh.md: Don't use union real_extract. diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 4071f5a277c..7df4df6e0fb 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -5798,6 +5798,20 @@ registers_ok_for_ldd_peep (reg1, reg2) ld [%o0 + 4], %o1 to ldd [%o0], %o0 + nor: + ld [%g3 + 4], %g3 + ld [%g3], %g2 + to + ldd [%g3], %g2 + + But, note that the transformation from: + ld [%g2 + 4], %g3 + ld [%g2], %g2 + to + ldd [%g2], %g2 + is perfectly fine. Thus, the peephole2 patterns always pass us + the destination register of the first load, never the second one. + For stores we don't have a similar problem, so dependent_reg_rtx is NULL_RTX. */ diff --git a/gcc/config/sparc/sparc.md b/gcc/config/sparc/sparc.md index 2426db5632d..d783fea8a2f 100644 --- a/gcc/config/sparc/sparc.md +++ b/gcc/config/sparc/sparc.md @@ -9062,7 +9062,7 @@ (set (match_operand:SI 2 "register_operand" "") (match_operand:SI 3 "memory_operand" ""))] "registers_ok_for_ldd_peep (operands[2], operands[0]) - && mems_ok_for_ldd_peep (operands[3], operands[1], operands[2])" + && mems_ok_for_ldd_peep (operands[3], operands[1], operands[0])" [(set (match_dup 2) (match_dup 3))] "operands[3] = change_address (operands[3], DImode, NULL); @@ -9087,7 +9087,7 @@ (set (match_operand:SF 2 "register_operand" "") (match_operand:SF 3 "memory_operand" ""))] "registers_ok_for_ldd_peep (operands[2], operands[0]) - && mems_ok_for_ldd_peep (operands[3], operands[1], operands[2])" + && mems_ok_for_ldd_peep (operands[3], operands[1], operands[0])" [(set (match_dup 2) (match_dup 3))] "operands[3] = change_address (operands[3], DFmode, NULL);