divmod, div, mod
Florent DEFAY
spira.inhabitant@gmail.com
Wed Apr 1 12:19:00 GMT 2009
>> 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).
Thank you.
Actually the processor give me nothing. It does not support div or mod
just like MSP430.
But when I take a look at msp430.md I find out that they implemented
divmodM4 with add and sub.
In your opinion, if a machine does not support mul/div/mod, should
these instructions always be
implemented in separate div and mod way?
Regards.
Florent
More information about the Gcc-help
mailing list