[avr] Fix PR60486: Typo cc_plus against cc_minus in calls of avr_out_plus_1

Submitted by Georg-Johann Lay on March 12, 2014, 1:35 p.m.

Details

Message ID 532062A4.8070805@gjlay.de
State New
Headers show

Commit Message

Georg-Johann Lay March 12, 2014, 1:35 p.m.
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.

Comments

Denis Chertykov March 13, 2014, 8:14 a.m.
2014-03-12 17:35 GMT+04:00 Georg-Johann Lay <avr@gjlay.de>:
> 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.
>

Please apply.
As I remember the trunk always open for port specific changes.

Denis.

Patch hide | download patch | download mbox

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)
     {