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

Renato Golin renato.golin at linaro.org
Tue Sep 9 01:37:08 PDT 2014


On 9 September 2014 02:18, Saleem Abdulrasool <compnerd at compnerd.org> wrote:
> The current implementations actually return 0.  Can you point out where that
> doesn't hold please?

With the current implementation...

int foo(int a) {
  return __aeabi_idiv0(a);
}

returns 'a', while:

int bar(int a) {
  return __aeabi_idiv(a, 0);
}

returns zero.


> Quoting the RTABI:
>
>    int __aeabi_idiv0(int return_value);
>    long long __aeabi_ldiv0(long long return_value);
>
> The *div0 functions:
>
> 􏰁  Return the value passed to them as a parameter.
>
> Is my copy out of date?

As I said before, all three behaviours are allowed by the RTABI
(exception, constant, parameter), but we now have two different
behaviours in compiler-rt. This is a regression.

We must make it consistent to what there was there before (return
zero). If you *really* want to make it return the parameter or signal,
we should discuss this properly, on another thread, but right now,
division by zero in compiler-rt has to return zero.

--renato




More information about the llvm-dev mailing list