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

Georg-Johann Lay <gjl at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2005-05-01 04:18:52         |2024-7-18
            Summary|usual arithmetic conversion |usual arithmetic conversion
                   |not applying correctly      |are sub-optimal

--- Comment #40 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
Still an issue on the current trunk with test case:

typedef __INT8_TYPE__  int8_t;

int8_t divmod_ss (int8_t s)
{
  return (int8_t) -3 % s;
}

compiles to

divmod_ss:
        mov r22,r24      ;  26  [c=12 l=3]  *extendqihi2/1
        lsl r24 
        sbc r23,r23
        ldi r24,lo8(-3)  ;  27  [c=4 l=2]  *movhi/4
        ldi r25,lo8(-1)
        call __divmodhi4         ;  28  [c=0 l=2]  *divmodhi4_call
/* epilogue start */
        ret              ;  31  [c=0 l=1]  return

$ avr-gcc div.c -S -Os -dp

Reply via email to