[llvm] r215862 - ARM: improve RTABI 4.2 conformance on Linux

Moritz Roth moritz.roth at arm.com
Thu Aug 21 05:19:07 PDT 2014


Hi Saleem,

>Hmm, somehow I missed that when I glanced at the asm output you sent out
>earlier.  That area does look incorrect.  You said that this same code
>works for -eabi targets?

Yes, and I think I've found out why now - we have custom lowering for 
SDIVREM/UDIVREM in ARMISelLowering.cpp, but on non-EABI targets that's
not used / overwritten (see ARMISelLowering.cpp:395 and :718).

If I change the check on line 718 to something like
	if (!isTargetAEABI() && !isTargetGNUEABI()) {
and define isTargetGNUEABI in the obvious way in ARMSubtarget.h,
the custom lowering is used for GNUEABI as well and the failures seem
to go away.

This is sort of a wild guess, but I think the proper way to fix this is
described in ARMSubtarget.h, where isTargetAEABI is defined:

  // ARM EABI is the bare-metal EABI described in ARM ABI documents and
  // can be accessed via -target arm-none-eabi. This is NOT GNUEABI.
  // FIXME: Add a flag for bare-metal for that target and set Triple::EABI
  // even for GNUEABI, so we can make a distinction here and still conform to
  // the EABI on GNU (and Android) mode. This requires change in Clang, too.

Joey actually pointed me at LowerDivRem from the beginning, but somehow
I didn't figure this out the first few times around...

Cheers
Moritz







More information about the llvm-commits mailing list