diff options
author | Weiming Zhao <weimingz@codeaurora.org> | 2017-03-24 17:06:00 +0000 |
---|---|---|
committer | Weiming Zhao <weimingz@codeaurora.org> | 2017-03-24 17:06:00 +0000 |
commit | c3709191b6d36c4c936173f4a9a29a734b12cb15 (patch) | |
tree | f5cec3e86f0d9f6d0602bea809b5886368d589a0 /lib/builtins/assembly.h | |
parent | b80243e5db3482b79da471ec578b35d6afbe8791 (diff) |
builtins: Select correct code fragments when compiling for Thumb1/Thum2/ARM ISA.
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 !
Reviewers: weimingz, rengolin, compnerd
Subscribers: aemerson, dim
Differential Revision: https://reviews.llvm.org/D30938
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@298713 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/builtins/assembly.h')
-rw-r--r-- | lib/builtins/assembly.h | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/lib/builtins/assembly.h b/lib/builtins/assembly.h index 29d9f8844..af959b24b 100644 --- a/lib/builtins/assembly.h +++ b/lib/builtins/assembly.h @@ -92,20 +92,35 @@ JMP(ip) #endif -#if __ARM_ARCH_ISA_THUMB == 2 +/* + * Determine actual [ARM][THUMB[1][2]] ISA using compiler predefined macros: + * - for '-mthumb -march=armv6' compiler defines '__thumb__' + * - for '-mthumb -march=armv7' compiler defines '__thumb__' and '__thumb2__' + */ +#if defined(__thumb2__) +#define USE_THUMB_2 1 +#elif defined(__thumb__) +#define USE_THUMB_1 1 +#endif + +#if defined(USE_THUMB_1) && defined(USE_THUMB_2) +#error "USE_THUMB_1 and USE_THUMB_2 can't be defined together." +#endif + +#if defined(USE_THUMB_1) || defined(USE_THUMB_1) +#define USE_THUMB_PROLOGUE 1 +#endif + +#if defined(USE_THUMB_2) #define IT(cond) it cond #define ITT(cond) itt cond +#define WIDE(op) op.w #else #define IT(cond) #define ITT(cond) -#endif - -#if __ARM_ARCH_ISA_THUMB == 2 -#define WIDE(op) op.w -#else #define WIDE(op) op #endif -#endif +#endif /* defined(__arm__) */ #define GLUE2(a, b) a##b #define GLUE(a, b) GLUE2(a, b) |