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
> Part of the concern is that the same code using / does call __aeabi_idiv > and __aeabi_uidiv.Ah, then that's definitely a bug, one way or the other. Odd, a very quick test of mine gave __aeabi_imod. Cheers. Tim.
On 9 December 2013 11:51, Joerg Sonnenberger <joerg at britannica.bec.de> wrote:> Part of the concern is that the same code using / does call __aeabi_idiv > and __aeabi_uidiv.Hi Joerg, I can see the error, and it's just a bad selection of choices. I was wrong in assuming that the "eabi" at the end would always force it: $ clang -target arm-elf-eabi -S mod.c -o - | grep mod .file "mod.c" bl __modsi3 bl __umodsi3 $ clang -target arm-none-eabi -S mod.c -o - | grep mod .file "mod.c" bl __aeabi_idivmod bl __aeabi_uidivmod This is clearly a bug and should be fixed. Please file a bug in bugzilla and I'll have a look at it. cheers, --renato
On Mon, Dec 09, 2013 at 01:58:29PM +0000, Renato Golin wrote:> I can see the error, and it's just a bad selection of choices. I was > wrong in assuming that the "eabi" at the end would always force it: > > $ clang -target arm-elf-eabi -S mod.c -o - | grep mod > .file "mod.c" > bl __modsi3 > bl __umodsi3I was discussing this with Tim on IRC and he raised the valid question of a pure mod operation being faster when emulated as it doesn't have to keep track of the quotient. So it really boils down to whether it has a fancy enough dress to be called a feature. Joerg