[Bug middle-end/124471] [AVR] Counterproductive byte copy optimization by multiplication

dimich.dmb at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Mar 13 10:10:17 GMT 2026


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

--- Comment #3 from Dmytro Bagrii <dimich.dmb at gmail dot com> ---
When argument is 16-bit, AVR optimizes it as expected as well:

uint16_t clone(uint16_t n) {
    return  (n & 0xFF) | (n << 8);
}


<clone>:
        98 2f           mov     r25, r24
        08 95           ret


More information about the Gcc-bugs mailing list