This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: divmod, div, mod
Florent DEFAY <spira.inhabitant@gmail.com> writes:
> My question is:
> should I implement umodhi3 and udivhi3 and include them in libgcc so
> __divsi3 is alright,
> or should I implement divmodsi4 to override __divsi3 and __modsi3?
It's a question of runtime efficiency. If it is faster to compute just
the quotient or the remainder, then implement __divsi3 and __modsi3 in
libgcc. If the processor gives you both the quotient and the remainder
at the same time, then implement the udivmodsi4 insn in the MD file
(e.g., avr.md).
Ian