This is an archive of the discontinued LLVM Phabricator instance.

builtins: Select correct code fragments when compiling for Thumb1/Thum2/ARM ISA.
AbandonedPublic

Authored by strejda on Mar 14 2017, 7:05 AM.

Details

Summary

Value of __ARM_ARCH_ISA_THUMB isn't based on the actual compilation
mode (-mthumb, -marm), it reflect's capability of given CPU.

Due to this:

  • use tbumb and thumb2 insteand of __ARM_ARCH_ISA_THUMB
  • use '.thumb' directive consistently in all affected files
  • decorate all thumb functions using DEFINE_COMPILERRT_THUMB_FUNCTION()

Note: This patch doesn't fix broken Thumb1 variant of __udivsi3 !

Diff Detail

Event Timeline

strejda created this revision.Mar 14 2017, 7:05 AM
compnerd requested changes to this revision.Mar 14 2017, 11:10 AM

I really think that we shouldnt introduce the USE_* macros, opting to re-organise the code (separate change) and then using the appropriate macros. It avoids the layer of indirection which makes it easier for others to follow what is going on.

This revision now requires changes to proceed.Mar 14 2017, 11:10 AM
weimingz added inline comments.Mar 20 2017, 3:53 PM
lib/builtins/assembly.h
97

If using '-march=armv6 -marm', thumb2 and thumb will both be defined.

I'm very sorry, but due to my current overload in FreeBSD, I will have not a free time to manage this for next week or two.
The problem is obvious, so please can you (or somebody else) take this review and process it to commit ?

lib/builtins/assembly.h
97

???
root@tegra124:~ # gcc49 -marm -march=armv6 -dM -E -x c /dev/null | grep thumb
root@tegra124:~ # gcc49 -marm -march=armv7-a -dM -E -x c /dev/null | grep thumb
root@tegra124:~ # gcc49 -mthumb -march=armv6 -dM -E -x c /dev/null | grep thumb
#define thumb 1
root@tegra124:~ # gcc49 -mthumb -march=armv7-a -dM -E -x c /dev/null | grep thumb
#define thumb2 1
#define thumb 1

root@tegra124:~ # clang -marm -march=armv6 -dM -E -x c /dev/null | grep thumb
root@tegra124:~ # clang -marm -march=armv7-a -dM -E -x c /dev/null | grep thumb
root@tegra124:~ # clang -mthumb -march=armv6 -dM -E -x c /dev/null | grep thumb
#define thumb 1
root@tegra124:~ # clang -mthumb -march=armv7-a -dM -E -x c /dev/null | grep thumb
#define thumb2 1
#define thumb 1
root@tegra124:~ #

weimingz edited edge metadata.Mar 21 2017, 4:13 PM

Hi Michal,

Looks the system won't let me upload a new revision under this patch.
I have to create a new one: https://reviews.llvm.org/D31220

This revision was automatically updated to reflect the committed changes.
weimingz reopened this revision.Mar 27 2017, 12:37 PM

it was commited by mistake and was reverted immediately.

This revision now requires changes to proceed.Mar 27 2017, 12:37 PM
strejda abandoned this revision.Mar 27 2017, 10:24 PM