[LLVMdev] [cfe-dev] ARM EABI and modulo

Joerg Sonnenberger
Mon, 09 Dec 2013 11:51:36 -0000

On Mon, Dec 09, 2013 at 07:56:26AM +0000, Tim Northover
wrote:
> Hi Joerg,
>
> > At the moment, this will call __modsi3 and __umodsi3, even though
those
> > functions are not part of AAPCS. Should this be considered a lowering
> > bug in the ARM target?
>
> LLVM actually supports both variants, depending on the target. The
> __aeabi_* functions are part of the ARM "runtime ABI" and largely
> independent of AAPCS. For whatever reason, Linux (& Darwin) ended up
> not adopting it and using those GNU functions instead.
>
> If NetBSD uses the aeabi ones instead, it probably needs some extra
> checks added to the code. I believe ELF targets currently decide based
> on whether the final part of the triple is "-eabi" or not (as
opposed
> to "-gnueabi", ...), though I haven't looked at the code
recently.

Part of the concern is that the same code using / does call __aeabi_idiv
and __aeabi_uidiv.

Joerg