This fixes a problem because cc_plus and cc_minus are in the wrong places in calls of avr_out_plus_1. This is important when avr_out_plus is called from notice_update_cc. This means that cc_status might be determined incorrectly.

In the vast majority of cases this leads to performance regression because of superfluous comparisons when an addition (using SUB instructions) has already set the condition code.

But there are also cases where this might lead to wrong code.

No changes in test suite results.

Ok to apply?


I didn't follow this list for some time. Is trunk open for such changes?

If so, I would apply it to trunk and 4.8 branch, otherwise to 4.8, 4.9 and trunk once they are open again.

Johann


        PR target/60486
        * config/avr/avr.c (avr_out_plus): Swap cc_plus and cc_minus in
        calls of avr_out_plus_1.
Index: config/avr/avr.c
===================================================================
--- config/avr/avr.c	(revision 208473)
+++ config/avr/avr.c	(working copy)
@@ -6812,8 +6812,8 @@ avr_out_plus (rtx insn, rtx *xop, int *p
 
   /* Work out the shortest sequence.  */
 
-  avr_out_plus_1 (op, &len_minus, MINUS, &cc_plus, code_sat, sign, out_label);
-  avr_out_plus_1 (op, &len_plus, PLUS, &cc_minus, code_sat, sign, out_label);
+  avr_out_plus_1 (op, &len_minus, MINUS, &cc_minus, code_sat, sign, out_label);
+  avr_out_plus_1 (op, &len_plus, PLUS, &cc_plus, code_sat, sign, out_label);
 
   if (plen)
     {

Reply via email to