[llvm-commits] Patch: compiler-rt/lib/divsi3.c: do not call udivsi3 directly

Stephen Canon scanon at apple.com
Fri Jun 22 07:13:57 PDT 2012


On Jun 22, 2012, at 4:10 AM, Anton Korobeynikov <anton at korobeynikov.info> wrote:

>> The patch doesn't seem that obvious at first glance -
>> does your assumption about the compiler behavior always hold? (if yes,
>> please add
>> an explicit comment about it) Also, I'm not the author of the core
>> compiler-rt lib and don't know if optional hardware support is desirable here.
> +1 We should be careful here and not to introduce the cycle (divsi
> calls udivs which will end calling divsi again :) )
> This seems to be not the case here, but we'll need to think about
> possible problems...

This is probably not too big of a risk; implementing signed division on the back of unsigned is far more common than the reverse situation.

However, there is another approach we could use; for specific architectures that have only an unsigned or signed division, simply add an arch-specific implementation in compiler-rt/lib/$(ARCH)/.  I don't expect there will be too many of these, so this is not unreasonable.

- Steve



More information about the llvm-commits mailing list