<div dir="ltr">On Tue, Sep 9, 2014 at 1:37 AM, Renato Golin <span dir="ltr"><<a href="mailto:renato.golin@linaro.org" target="_blank">renato.golin@linaro.org</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 9 September 2014 02:18, Saleem Abdulrasool <<a href="mailto:compnerd@compnerd.org">compnerd@compnerd.org</a>> wrote:<br>
> The current implementations actually return 0.  Can you point out where that<br>
> doesn't hold please?<br>
<br>
</span>With the current implementation...<br>
<br>
int foo(int a) {<br>
  return __aeabi_idiv0(a);<br>
}<br>
<br>
returns 'a', while:<br>
<br>
int bar(int a) {<br>
  return __aeabi_idiv(a, 0);<br>
}<br>
<br>
returns zero.<br>
<span class=""><br>
<br>
> Quoting the RTABI:<br>
><br>
>    int __aeabi_idiv0(int return_value);<br>
>    long long __aeabi_ldiv0(long long return_value);<br>
><br>
> The *div0 functions:<br>
><br>
> 􏰁  Return the value passed to them as a parameter.<br>
><br>
> Is my copy out of date?<br>
<br>
</span>As I said before, all three behaviours are allowed by the RTABI<br>
(exception, constant, parameter), but we now have two different<br>
behaviours in compiler-rt. This is a regression.<br>
<br>
We must make it consistent to what there was there before (return<br>
zero). If you *really* want to make it return the parameter or signal,<br>
we should discuss this properly, on another thread, but right now,<br>
division by zero in compiler-rt has to return zero.</blockquote><div><br></div><div>Oh!  I think I see what the confusion is all about.  __aeabi_[il]div0 are *NOT* division routines.  They are handlers for the error case of division by zero.  They do not perform a division by zero, they effectively are meant to trap the fact that a division by zero has occurred.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="HOEnZb"><font color="#888888"><br>
--renato<br>
</font></span></blockquote></div><br>-- <br>Saleem Abdulrasool<br>compnerd (at) compnerd (dot) org
</div></div>