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

--- Comment #2 from Kamil Kaznowski <kamkaz at windowslive dot com> ---
(In reply to Andrew Pinski from comment #1)
> There is another bug dealing with division and truncation that was just
> filed. It is a generic (non-avr) issue.

I assume you mentioned this bug here:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115036

It is not quite the same, since here we are dealing with literals. In case of
literals, it is an existing optimization.

#include <stdint.h>

uint16_t functino(uint16_t num) {
    return (7500ULL) / num;
}

This snippet, even compiled with `avr-gcc -O0`, will use __udivmodhi4, 16-bit
routine. It seems that 24-bit routines are simply not considered, unless the
operands are specifically typed __(u)int24.

Reply via email to