diff options
author | Weiming Zhao <weimingz@codeaurora.org> | 2017-03-24 17:08:35 +0000 |
---|---|---|
committer | Weiming Zhao <weimingz@codeaurora.org> | 2017-03-24 17:08:35 +0000 |
commit | 9736f90434cf210271d30af6972075ac4b36694f (patch) | |
tree | a205776d5b57d1bbfff45409138b0a6038d78588 /lib | |
parent | c651b5d41839aae2711af96c24b19949a1f38014 (diff) |
Revert "builtins: Select correct code fragments when compiling for Thumb1/Thum2/ARM ISA."
This reverts commit c3709191b6d36c4c936173f4a9a29a734b12cb15.
(commit by mistake)
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@298715 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/builtins/arm/aeabi_idivmod.S | 15 | ||||
-rw-r--r-- | lib/builtins/arm/aeabi_uidivmod.S | 8 | ||||
-rw-r--r-- | lib/builtins/arm/bswapdi2.S | 4 | ||||
-rw-r--r-- | lib/builtins/arm/bswapsi2.S | 4 | ||||
-rw-r--r-- | lib/builtins/arm/clzdi2.S | 4 | ||||
-rw-r--r-- | lib/builtins/arm/clzsi2.S | 4 | ||||
-rw-r--r-- | lib/builtins/arm/comparesf2.S | 38 | ||||
-rw-r--r-- | lib/builtins/arm/divmodsi4.S | 4 | ||||
-rw-r--r-- | lib/builtins/arm/divsi3.S | 12 | ||||
-rw-r--r-- | lib/builtins/arm/modsi3.S | 4 | ||||
-rw-r--r-- | lib/builtins/arm/udivmodsi4.S | 9 | ||||
-rw-r--r-- | lib/builtins/arm/udivsi3.S | 29 | ||||
-rw-r--r-- | lib/builtins/arm/umodsi3.S | 8 | ||||
-rw-r--r-- | lib/builtins/assembly.h | 29 |
14 files changed, 64 insertions, 108 deletions
diff --git a/lib/builtins/arm/aeabi_idivmod.S b/lib/builtins/arm/aeabi_idivmod.S index 4419929f6..0164b15dc 100644 --- a/lib/builtins/arm/aeabi_idivmod.S +++ b/lib/builtins/arm/aeabi_idivmod.S @@ -20,25 +20,16 @@ #endif .syntax unified - .syntax unified - .text -#if defined(USE_THUMB_PROLOGUE) - .thumb -#endif .p2align 2 -#if defined(USE_THUMB_PROLOGUE) -DEFINE_COMPILERRT_THUMB_FUNCTION(__aeabi_idivmod) -#else DEFINE_COMPILERRT_FUNCTION(__aeabi_idivmod) -#endif -#if defined(USE_THUMB_1) +#if __ARM_ARCH_ISA_THUMB == 1 push {r0, r1, lr} bl SYMBOL_NAME(__divsi3) pop {r1, r2, r3} // now r0 = quot, r1 = num, r2 = denom muls r2, r0, r2 // r2 = quot * denom subs r1, r1, r2 JMP (r3) -#else // defined(USE_THUMB_1) +#else push { lr } sub sp, sp, #4 mov r2, sp @@ -51,7 +42,7 @@ DEFINE_COMPILERRT_FUNCTION(__aeabi_idivmod) ldr r1, [sp] add sp, sp, #4 pop { pc } -#endif // defined(USE_THUMB_1) +#endif // __ARM_ARCH_ISA_THUMB == 1 END_COMPILERRT_FUNCTION(__aeabi_idivmod) NO_EXEC_STACK_DIRECTIVE diff --git a/lib/builtins/arm/aeabi_uidivmod.S b/lib/builtins/arm/aeabi_uidivmod.S index 37dae4a10..a627fc740 100644 --- a/lib/builtins/arm/aeabi_uidivmod.S +++ b/lib/builtins/arm/aeabi_uidivmod.S @@ -21,16 +21,8 @@ #endif .syntax unified - .text -#if defined(USE_THUMB_PROLOGUE) - .thumb -#endif .p2align 2 -#if defined(USE_THUMB_PROLOGUE) -DEFINE_COMPILERRT_THUMB_FUNCTION(__aeabi_uidivmod) -#else DEFINE_COMPILERRT_FUNCTION(__aeabi_uidivmod) -#endif #if __ARM_ARCH_ISA_THUMB == 1 cmp r0, r1 bcc LOCAL_LABEL(case_denom_larger) diff --git a/lib/builtins/arm/bswapdi2.S b/lib/builtins/arm/bswapdi2.S index 4e5a579cf..fb226cea2 100644 --- a/lib/builtins/arm/bswapdi2.S +++ b/lib/builtins/arm/bswapdi2.S @@ -11,7 +11,7 @@ .syntax unified .text -#if defined(USE_THUMB_PROLOGUE) +#if __ARM_ARCH_ISA_THUMB == 2 .thumb #endif @@ -21,7 +21,7 @@ // Reverse all the bytes in a 64-bit integer. // .p2align 2 -#if defined(USE_THUMB_PROLOGUE) +#if __ARM_ARCH_ISA_THUMB == 2 DEFINE_COMPILERRT_THUMB_FUNCTION(__bswapdi2) #else DEFINE_COMPILERRT_FUNCTION(__bswapdi2) diff --git a/lib/builtins/arm/bswapsi2.S b/lib/builtins/arm/bswapsi2.S index 60342ae0f..553c3c2e3 100644 --- a/lib/builtins/arm/bswapsi2.S +++ b/lib/builtins/arm/bswapsi2.S @@ -11,7 +11,7 @@ .syntax unified .text -#if defined(USE_THUMB_PROLOGUE) +#if __ARM_ARCH_ISA_THUMB == 2 .thumb #endif @@ -21,7 +21,7 @@ // Reverse all the bytes in a 32-bit integer. // .p2align 2 -#if defined(USE_THUMB_PROLOGUE) +#if __ARM_ARCH_ISA_THUMB == 2 DEFINE_COMPILERRT_THUMB_FUNCTION(__bswapsi2) #else DEFINE_COMPILERRT_FUNCTION(__bswapsi2) diff --git a/lib/builtins/arm/clzdi2.S b/lib/builtins/arm/clzdi2.S index fe56a183f..6068c176f 100644 --- a/lib/builtins/arm/clzdi2.S +++ b/lib/builtins/arm/clzdi2.S @@ -15,13 +15,13 @@ .syntax unified .text -#if defined(USE_THUMB_PROLOGUE) +#if __ARM_ARCH_ISA_THUMB == 2 .thumb #endif .p2align 2 -#if defined(USE_THUMB_PROLOGUE) +#if __ARM_ARCH_ISA_THUMB == 2 DEFINE_COMPILERRT_THUMB_FUNCTION(__clzdi2) #else DEFINE_COMPILERRT_FUNCTION(__clzdi2) diff --git a/lib/builtins/arm/clzsi2.S b/lib/builtins/arm/clzsi2.S index 28d43041e..c2ba3a8cf 100644 --- a/lib/builtins/arm/clzsi2.S +++ b/lib/builtins/arm/clzsi2.S @@ -15,12 +15,12 @@ .syntax unified .text -#if defined(USE_THUMB_PROLOGUE) +#if __ARM_ARCH_ISA_THUMB == 2 .thumb #endif .p2align 2 -#if defined(USE_THUMB_PROLOGUE) +#if __ARM_ARCH_ISA_THUMB == 2 DEFINE_COMPILERRT_THUMB_FUNCTION(__clzsi2) #else DEFINE_COMPILERRT_FUNCTION(__clzsi2) diff --git a/lib/builtins/arm/comparesf2.S b/lib/builtins/arm/comparesf2.S index 1f7031cbf..ef7091bf3 100644 --- a/lib/builtins/arm/comparesf2.S +++ b/lib/builtins/arm/comparesf2.S @@ -38,20 +38,15 @@ //===----------------------------------------------------------------------===// #include "../assembly.h" - .syntax unified - .text -#if defined(USE_THUMB_PROLOGUE) - .thumb +.syntax unified +#if __ARM_ARCH_ISA_THUMB == 2 +.thumb #endif @ int __eqsf2(float a, float b) .p2align 2 -#if defined(USE_THUMB_PROLOGUE) -DEFINE_COMPILERRT_THUMB_FUNCTION(__eqsf2) -#else DEFINE_COMPILERRT_FUNCTION(__eqsf2) -#endif #if defined(COMPILER_RT_ARMHF_TARGET) vmov r0, s0 vmov r1, s1 @@ -72,7 +67,7 @@ DEFINE_COMPILERRT_FUNCTION(__eqsf2) // flag if both a and b are zero (of either sign). The shift of r3 doesn't // effect this at all, but it *does* make sure that the C flag is clear for // the subsequent operations. -#if defined(USE_THUMB_1) +#if __ARM_ARCH_ISA_THUMB == 1 lsrs r6, r3, #1 orrs r6, r2 #else @@ -80,7 +75,7 @@ DEFINE_COMPILERRT_FUNCTION(__eqsf2) #endif // Next, we check if a and b have the same or different signs. If they have // opposite signs, this eor will set the N flag. -#if defined(USE_THUMB_1) +#if __ARM_ARCH_ISA_THUMB == 1 beq 1f movs r6, r0 eors r6, r1 @@ -94,7 +89,7 @@ DEFINE_COMPILERRT_FUNCTION(__eqsf2) // ignoring NaNs for now), this subtract will zero out r0. If they have the // same sign, the flags are updated as they would be for a comparison of the // absolute values of a and b. -#if defined(USE_THUMB_1) +#if __ARM_ARCH_ISA_THUMB == 1 bmi 1f subs r0, r2, r3 1: @@ -113,7 +108,7 @@ DEFINE_COMPILERRT_FUNCTION(__eqsf2) // still clear from the shift argument in orrs; if a is positive and b // negative, this places 0 in r0; if a is negative and b positive, -1 is // placed in r0. -#if defined(USE_THUMB_1) +#if __ARM_ARCH_ISA_THUMB == 1 bhs 1f // Here if a and b have the same sign and absA < absB, the result is thus // b < 0 ? 1 : -1. Same if a and b have the opposite sign (ignoring Nan). @@ -132,7 +127,7 @@ DEFINE_COMPILERRT_FUNCTION(__eqsf2) // the sign of b in r0. Thus, if both are negative and a < b, -1 is placed // in r0, which is the desired result. Conversely, if both are positive // and a > b, zero is placed in r0. -#if defined(USE_THUMB_1) +#if __ARM_ARCH_ISA_THUMB == 1 bls 1f // Here both have the same sign and absA > absB. movs r0, #1 @@ -150,14 +145,14 @@ DEFINE_COMPILERRT_FUNCTION(__eqsf2) // If a == b, then the Z flag is set, so we can get the correct final value // into r0 by simply or'ing with 1 if Z is clear. // For Thumb-1, r0 contains -1 if a < b, 0 if a > b and 0 if a == b. -#if defined(USE_THUMB_1) +#if __ARM_ARCH_ISA_THUMB != 1 it ne orrne r0, r0, #1 #endif // Finally, we need to deal with NaNs. If either argument is NaN, replace // the value in r0 with 1. -#if defined(USE_THUMB_1) +#if __ARM_ARCH_ISA_THUMB == 1 LOCAL_LABEL(CHECK_NAN): movs r6, #0xff lsls r6, #24 @@ -185,11 +180,7 @@ DEFINE_COMPILERRT_FUNCTION_ALIAS(__nesf2, __eqsf2) @ int __gtsf2(float a, float b) .p2align 2 -#if defined(USE_THUMB) -DEFINE_COMPILERRT_THUMB_FUNCTION(__gtsf2) -#else DEFINE_COMPILERRT_FUNCTION(__gtsf2) -#endif // Identical to the preceding except in that we return -1 for NaN values. // Given that the two paths share so much code, one might be tempted to // unify them; however, the extra code needed to do so makes the code size @@ -198,7 +189,7 @@ DEFINE_COMPILERRT_FUNCTION(__gtsf2) vmov r0, s0 vmov r1, s1 #endif -#if defined(USE_THUMB_1) +#if __ARM_ARCH_ISA_THUMB == 1 push {r6, lr} lsls r2, r0, #1 lsls r3, r1, #1 @@ -263,12 +254,7 @@ DEFINE_COMPILERRT_FUNCTION_ALIAS(__gesf2, __gtsf2) @ int __unordsf2(float a, float b) .p2align 2 -#if defined(USE_THUMB) -DEFINE_COMPILERRT_THUMB_FUNCTION(__unordsf2) -#else DEFINE_COMPILERRT_FUNCTION(__unordsf2) -#endif - #if defined(COMPILER_RT_ARMHF_TARGET) vmov r0, s0 vmov r1, s1 @@ -277,7 +263,7 @@ DEFINE_COMPILERRT_FUNCTION(__unordsf2) lsls r2, r0, #1 lsls r3, r1, #1 movs r0, #0 -#if defined(USE_THUMB_1) +#if __ARM_ARCH_ISA_THUMB == 1 movs r1, #0xff lsls r1, #24 cmp r2, r1 diff --git a/lib/builtins/arm/divmodsi4.S b/lib/builtins/arm/divmodsi4.S index 3c8359852..999c310ec 100644 --- a/lib/builtins/arm/divmodsi4.S +++ b/lib/builtins/arm/divmodsi4.S @@ -23,7 +23,7 @@ .syntax unified .text -#if defined(USE_THUMB_PROLOGUE) +#if __ARM_ARCH_ISA_THUMB == 2 .thumb #endif @@ -32,7 +32,7 @@ @ value is the quotient, the remainder is placed in the variable. .p2align 3 -#if defined(USE_THUMB_PROLOGUE) +#if __ARM_ARCH_ISA_THUMB == 2 DEFINE_COMPILERRT_THUMB_FUNCTION(__divmodsi4) #else DEFINE_COMPILERRT_FUNCTION(__divmodsi4) diff --git a/lib/builtins/arm/divsi3.S b/lib/builtins/arm/divsi3.S index ad96c9e5b..f066f60ad 100644 --- a/lib/builtins/arm/divsi3.S +++ b/lib/builtins/arm/divsi3.S @@ -20,10 +20,10 @@ #define CLEAR_FRAME_AND_RETURN \ pop {r4, r7, pc} - .syntax unified - .text -#if defined(USE_THUMB_PROLOGUE) - .thumb + .syntax unified + .text +#if __ARM_ARCH_ISA_THUMB == 2 + .thumb #endif .p2align 3 @@ -33,7 +33,7 @@ DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_idiv, __divsi3) @ int __divsi3(int divident, int divisor) @ Calculate and return the quotient of the (signed) division. -#if defined(USE_THUMB_PROLOGUE) +#if __ARM_ARCH_ISA_THUMB == 2 DEFINE_COMPILERRT_THUMB_FUNCTION(__divsi3) #else DEFINE_COMPILERRT_FUNCTION(__divsi3) @@ -72,7 +72,7 @@ ESTABLISH_FRAME // abs(a) / abs(b) bl SYMBOL_NAME(__udivsi3) // Apply sign of quotient to result and return. -# if defined(USE_THUMB_1) +# if __ARM_ARCH_ISA_THUMB == 1 asrs r4, #31 eors r0, r4 subs r0, r0, r4 diff --git a/lib/builtins/arm/modsi3.S b/lib/builtins/arm/modsi3.S index 0986d8494..1d302edc6 100644 --- a/lib/builtins/arm/modsi3.S +++ b/lib/builtins/arm/modsi3.S @@ -22,7 +22,7 @@ .syntax unified .text -#if defined(USE_THUMB_PROLOGUE) +#if __ARM_ARCH_ISA_THUMB == 2 .thumb #endif @@ -30,7 +30,7 @@ @ Calculate and return the remainder of the (signed) division. .p2align 3 -#if defined(USE_THUMB_PROLOGUE) +#if __ARM_ARCH_ISA_THUMB == 2 DEFINE_COMPILERRT_THUMB_FUNCTION(__modsi3) #else DEFINE_COMPILERRT_FUNCTION(__modsi3) diff --git a/lib/builtins/arm/udivmodsi4.S b/lib/builtins/arm/udivmodsi4.S index 860fced63..1ad8ee34b 100644 --- a/lib/builtins/arm/udivmodsi4.S +++ b/lib/builtins/arm/udivmodsi4.S @@ -16,7 +16,8 @@ .syntax unified .text -#if defined(USE_THUMB_PROLOGUE) + +#if __ARM_ARCH_ISA_THUMB == 2 .thumb #endif @@ -26,7 +27,7 @@ @ value is the quotient, the remainder is placed in the variable. .p2align 2 -#if defined(USE_THUMB_PROLOGUE) +#if __ARM_ARCH_ISA_THUMB == 2 DEFINE_COMPILERRT_THUMB_FUNCTION(__udivmodsi4) #else DEFINE_COMPILERRT_FUNCTION(__udivmodsi4) @@ -66,7 +67,7 @@ DEFINE_COMPILERRT_FUNCTION(__udivmodsi4) clz r3, r1 /* r0 >= r1 implies clz(r0) <= clz(r1), so ip <= r3. */ sub r3, r3, ip -# if defined(USE_THUMB_2) +# if __ARM_ARCH_ISA_THUMB == 2 adr ip, LOCAL_LABEL(div0block) + 1 sub ip, ip, r3, lsl #1 # else @@ -77,7 +78,7 @@ DEFINE_COMPILERRT_FUNCTION(__udivmodsi4) mov r3, #0 bx ip # else -# if defined(USE_THUMB_2) +# if __ARM_ARCH_ISA_THUMB == 2 # error THUMB mode requires CLZ or UDIV # endif str r4, [sp, #-8]! diff --git a/lib/builtins/arm/udivsi3.S b/lib/builtins/arm/udivsi3.S index 2a0209927..fcc472b4f 100644 --- a/lib/builtins/arm/udivsi3.S +++ b/lib/builtins/arm/udivsi3.S @@ -16,7 +16,8 @@ .syntax unified .text -#if defined(USE_THUMB_PROLOGUE) + +#if __ARM_ARCH_ISA_THUMB == 2 .thumb #endif @@ -26,7 +27,7 @@ DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_uidiv, __udivsi3) @ unsigned int __udivsi3(unsigned int divident, unsigned int divisor) @ Calculate and return the quotient of the (unsigned) division. -#if defined(USE_THUMB_PROLOGUE) +#if __ARM_ARCH_ISA_THUMB == 2 DEFINE_COMPILERRT_THUMB_FUNCTION(__udivsi3) #else DEFINE_COMPILERRT_FUNCTION(__udivsi3) @@ -39,7 +40,7 @@ DEFINE_COMPILERRT_FUNCTION(__udivsi3) #else cmp r1, #1 bcc LOCAL_LABEL(divby0) -#if defined(USE_THUMB_1) +#if __ARM_ARCH_ISA_THUMB == 1 bne LOCAL_LABEL(num_neq_denom) JMP(lr) LOCAL_LABEL(num_neq_denom): @@ -48,7 +49,7 @@ LOCAL_LABEL(num_neq_denom): JMPc(lr, eq) #endif cmp r0, r1 -#if defined(USE_THUMB_1) +#if __ARM_ARCH_ISA_THUMB == 1 bhs LOCAL_LABEL(num_ge_denom) movs r0, #0 JMP(lr) @@ -80,7 +81,7 @@ LOCAL_LABEL(num_ge_denom): clz r3, r1 /* r0 >= r1 implies clz(r0) <= clz(r1), so ip <= r3. */ sub r3, r3, ip -# if defined(USE_THUMB_2) +# if __ARM_ARCH_ISA_THUMB == 2 adr ip, LOCAL_LABEL(div0block) + 1 sub ip, ip, r3, lsl #1 # else @@ -91,17 +92,17 @@ LOCAL_LABEL(num_ge_denom): mov r3, #0 bx ip # else /* No CLZ Feature */ -# if defined(USE_THUMB_2) +# if __ARM_ARCH_ISA_THUMB == 2 # error THUMB mode requires CLZ or UDIV # endif -# if defined(USE_THUMB_1) +# if __ARM_ARCH_ISA_THUMB == 1 # define BLOCK_SIZE 10 # else # define BLOCK_SIZE 12 # endif mov r2, r0 -# if defined(USE_THUMB_1) +# if __ARM_ARCH_ISA_THUMB == 1 mov ip, r0 adr r0, LOCAL_LABEL(div0block) adds r0, #1 @@ -110,7 +111,7 @@ LOCAL_LABEL(num_ge_denom): # endif lsrs r3, r2, #16 cmp r3, r1 -# if defined(USE_THUMB_1) +# if __ARM_ARCH_ISA_THUMB == 1 blo LOCAL_LABEL(skip_16) movs r2, r3 subs r0, r0, #(16 * BLOCK_SIZE) @@ -122,7 +123,7 @@ LOCAL_LABEL(skip_16): lsrs r3, r2, #8 cmp r3, r1 -# if defined(USE_THUMB_1) +# if __ARM_ARCH_ISA_THUMB == 1 blo LOCAL_LABEL(skip_8) movs r2, r3 subs r0, r0, #(8 * BLOCK_SIZE) @@ -134,7 +135,7 @@ LOCAL_LABEL(skip_8): lsrs r3, r2, #4 cmp r3, r1 -# if defined(USE_THUMB_1) +# if __ARM_ARCH_ISA_THUMB == 1 blo LOCAL_LABEL(skip_4) movs r2, r3 subs r0, r0, #(4 * BLOCK_SIZE) @@ -146,7 +147,7 @@ LOCAL_LABEL(skip_4): lsrs r3, r2, #2 cmp r3, r1 -# if defined(USE_THUMB_1) +# if __ARM_ARCH_ISA_THUMB == 1 blo LOCAL_LABEL(skip_2) movs r2, r3 subs r0, r0, #(2 * BLOCK_SIZE) @@ -157,7 +158,7 @@ LOCAL_LABEL(skip_2): # endif /* Last block, no need to update r2 or r3. */ -# if defined(USE_THUMB_1) +# if __ARM_ARCH_ISA_THUMB == 1 lsrs r3, r2, #1 cmp r3, r1 blo LOCAL_LABEL(skip_1) @@ -190,7 +191,7 @@ LOCAL_LABEL(divby0): JMP(lr) -#if defined(USE_THUMB_1) +#if __ARM_ARCH_ISA_THUMB == 1 #define block(shift) \ lsls r2, r1, IMM shift; \ cmp r0, r2; \ diff --git a/lib/builtins/arm/umodsi3.S b/lib/builtins/arm/umodsi3.S index 90f3e8575..672487e81 100644 --- a/lib/builtins/arm/umodsi3.S +++ b/lib/builtins/arm/umodsi3.S @@ -16,7 +16,7 @@ .syntax unified .text -#if defined(USE_THUMB_PROLOGUE) +#if __ARM_ARCH_ISA_THUMB == 2 .thumb #endif @@ -24,7 +24,7 @@ @ Calculate and return the remainder of the (unsigned) division. .p2align 2 -#if defined(USE_THUMB_PROLOGUE) +#if __ARM_ARCH_ISA_THUMB == 2 DEFINE_COMPILERRT_THUMB_FUNCTION(__umodsi3) #else DEFINE_COMPILERRT_FUNCTION(__umodsi3) @@ -65,7 +65,7 @@ DEFINE_COMPILERRT_FUNCTION(__umodsi3) clz r3, r1 /* r0 >= r1 implies clz(r0) <= clz(r1), so ip <= r3. */ sub r3, r3, ip -# if defined(USE_THUMB_2) +# if __ARM_ARCH_ISA_THUMB == 2 adr ip, LOCAL_LABEL(div0block) + 1 sub ip, ip, r3, lsl #1 # else @@ -74,7 +74,7 @@ DEFINE_COMPILERRT_FUNCTION(__umodsi3) sub ip, ip, r3, lsl #3 bx ip # else -# if defined(USE_THUMB_2) +# if __ARM_ARCH_ISA_THUMB == 2 # error THUMB mode requires CLZ or UDIV # endif mov r2, r0 diff --git a/lib/builtins/assembly.h b/lib/builtins/assembly.h index af959b24b..29d9f8844 100644 --- a/lib/builtins/assembly.h +++ b/lib/builtins/assembly.h @@ -92,35 +92,20 @@ JMP(ip) #endif -/* - * 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) +#if __ARM_ARCH_ISA_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 /* defined(__arm__) */ +#endif #define GLUE2(a, b) a##b #define GLUE(a, b) GLUE2(a, b) |