<div dir="ltr">On Thu, Aug 21, 2014 at 5:19 AM, Moritz Roth <span dir="ltr"><<a href="mailto:moritz.roth@arm.com" target="_blank">moritz.roth@arm.com</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">Hi Saleem,<br>
<div class=""><br>
>Hmm, somehow I missed that when I glanced at the asm output you sent out<br>
>earlier.  That area does look incorrect.  You said that this same code<br>
>works for -eabi targets?<br>
<br>
</div>Yes, and I think I've found out why now - we have custom lowering for<br>
SDIVREM/UDIVREM in ARMISelLowering.cpp, but on non-EABI targets that's<br>
not used / overwritten (see ARMISelLowering.cpp:395 and :718).<br>
<br>
If I change the check on line 718 to something like<br>
        if (!isTargetAEABI() && !isTargetGNUEABI()) {<br>
and define isTargetGNUEABI in the obvious way in ARMSubtarget.h,<br>
the custom lowering is used for GNUEABI as well and the failures seem<br>
to go away.<br>
<br>
This is sort of a wild guess, but I think the proper way to fix this is<br>
described in ARMSubtarget.h, where isTargetAEABI is defined:<br>
<br>
  // ARM EABI is the bare-metal EABI described in ARM ABI documents and<br>
  // can be accessed via -target arm-none-eabi. This is NOT GNUEABI.<br>
  // FIXME: Add a flag for bare-metal for that target and set Triple::EABI<br>
  // even for GNUEABI, so we can make a distinction here and still conform to<br>
  // the EABI on GNU (and Android) mode. This requires change in Clang, too.<br></blockquote><div><br></div><div>Sorry, Im afraid I don't understand something here.  Why would we want a flag for the "bare-metal" target?  I believe both environments should conform to the RTABI (which defines the functions being used).  As it stands, compiler-rt (correctly, AIUI) doesn't change behavior based on the "bare-metal" vs Linux or Android.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Joey actually pointed me at LowerDivRem from the beginning, but somehow<br>
I didn't figure this out the first few times around...<br>
<br>
Cheers<br>
<span class="HOEnZb"><font color="#888888">Moritz<br>
<br>
<br>
<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br>Saleem Abdulrasool<br>compnerd (at) compnerd (dot) org
</div></div>