https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97276

--- Comment #4 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
Created attachment 54518
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54518&action=edit
pwn-i.c pre-compiled test case

Ok, I found it and attached a cleaned-up version.

IIUC correctly, the relevant options you are using to compile are: -O1
-mmcu=atxmega32a4 -g -ggdb -std=gnu99

With these options (and with -fverbose-asm to easier navigate in asm) I could
not reproduce the problem with avr-gcc v8.5.  The respective part of .s reads
(I dropped -g for legibility, but with -g it's same):

 ;  pwm-i.c:287:         if (last_brightness < 181 && j >= 181)
        ldi r30,lo8(-76)         ; ,     ;  320 [c=4 l=1]  movqi_insn/1
        cp r30,r11               ; , last_brightness     ;  193 [c=4 l=1] 
cmpqi3/1
        brsh .+2         ;       ;  194 [c=16 l=2]  branch
        rjmp .L16        ; 
 ;  pwm-i.c:287:         if (last_brightness < 181 && j >= 181)
        cpi r22,lo8(-75)         ;  iftmp.3_5,   ;  196 [c=4 l=1]  cmpqi3/2
        brsh .+2         ;       ;  197 [c=16 l=2]  branch
        rjmp .L16        ; 
 ;  pwm-i.c:289:             slot->top = 0xfe00;
        st X+,r8         ;  tmp226       ;  200 [c=4 l=3]  *movhi/3
        st X,r9  ;  tmp226
        sbiw r26,1
 ;  pwm-i.c:290:             slot->mask = ~mask;
        movw r30,r24     ;  tmp200, mask         ;  321 [c=4 l=1]  *movhi/0
        com r30  ;  tmp200       ;  201 [c=8 l=2]  one_cmplhi2
        com r31  ;  tmp200
 ;  pwm-i.c:290:             slot->mask = ~mask;
        adiw r26,2       ;  slot_172->mask       ;  202 [c=4 l=4]  *movhi/3
        st X+,r30        ;  tmp200
        st X,r31         ;  tmp200
        sbiw r26,2+1     ;  slot_172->mask
 ;  pwm-i.c:291:             ++slot;
        adiw r26,4       ;  slot,        ;  203 [c=4 l=1]  addhi3_clobber/0

Reply via email to