Summary: | [3.3 only][avr-gcc] Optimization of "uchar/xor/and/single_bit" produced wrong code. | ||
---|---|---|---|
Product: | gcc | Reporter: | Dmitry K. <dmixm> |
Component: | rtl-optimization | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED DUPLICATE | ||
Severity: | normal | CC: | eric.weddington, gcc-bugs |
Priority: | P2 | Keywords: | wrong-code |
Version: | 3.3.1 | ||
Target Milestone: | 3.3.2 | ||
Host: | Target: | avr-*-none | |
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | 2003-07-06 01:30:31 |
Description
Dmitry K.
2003-06-13 03:10:30 UTC
I can confirm this on the mainline (20030706) but with -Os. This appears to be a duplicate of 11662. Could you try the patch attached to that report and see if that help? regards Christian It looks like the mainline (20030728) is still broken with -Os (but I do not read avr asm.): .L2: rcall f ldi r25,lo8(1) eor r25,r24 sbrs r25,0 rjmp .L2 Could you say if that works (is rjmp unconditional jump?)? It works on the mainline, I looked at the RTL at the last stage and it had: (jump_insn 19 18 24 (set (pc) (if_then_else (eq (zero_extract:HI (reg:QI 25 r25 [42]) (const_int 1 [0x1]) (const_int 0 [0x0])) (const_int 0 [0x0])) (label_ref 9) (pc))) 97 {*sbrx_branch} (insn_list 13 (nil)) (expr_list:REG_DEAD (reg:QI 25 r25 [42]) (expr_list:REG_BR_PROB (const_int 8900 [0x22c4]) (nil)))) So it worked. I will test the patch to find out if it fixes the problem on 3.3.1. Subject: Re: [avr-gcc] Optimization of "uchar/xor/and/single_bit" produced wrong code. On Mon, Jul 28, 2003 at 04:20:58PM -0000, pinskia at physics dot uc dot edu wrote: > It looks like the mainline (20030728) is still broken with -Os > (but I do not read avr asm.): I've never seen an avr either ;-) But now gcc at least emmits an eor after the call which is definitely a progression wrt. the assembly in the audit trail. > .L2: > rcall f > ldi r25,lo8(1) > eor r25,r24 > sbrs r25,0 > rjmp .L2 I found an avr tutorial at http://www.avr-asm-tutorial.net/avr_en/beginner/index.html and this tells me that sbrs skips the next instruction if Bit 0 in r25 ist set. I.e. this code looks correct to me. regards Christian |