[LLVMdev] [Compiler-RT] [ARM] Where __aeabi_[il]div0 builtins should be implemented?

Sergey Dmitrouk sdmitrouk at accesssoftek.com
Sat Sep 6 05:09:27 PDT 2014


On Sat, Sep 06, 2014 at 04:48:20AM -0700, Renato Golin wrote:
> I'm in favour for adding them ASAP, but we might need an ifdef to avoid
> creating unnecessary (or conflicting) symbols for non-EABI targets.

Sure, it makes sense.

> A proper solution would be to have:
>
> LOCAL_LABEL(divby0):
> #ifdef __ARM_EABI__
>   b __aeabi_idiv0
> #else
>   mov r0, #0
>   JMP(lr)
> #endif
>
> And make both __aeabi_{i,l}div0 return 0.
>
> I'm hoping both parts of the ifdef to generate *identical* code, but
> with the benefit that we can change the behaviour of div0 by
> overriding the function's implementation.

I missed that

    mov r0, #0

line.  It really shouldn't be there for EABI targets.

Will see what Saleem (and maybe others) thinks of this, maybe there is a
non-obvious reason to do not implement these functions in compiler-rt.

Regards,
Sergey



More information about the llvm-dev mailing list