mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 13:12:37 -05:00
Fix unified syntax in ARM inline assembly
GCC 4.9 always emits assembly with divided syntax. Setting unified syntax in inline assembly causes the assembler to complain about GCC's generated code, because the directive extends past the scope of the inline asm. Fix this by setting divided mode at the end of the inline assembly block. The assembler directives are hidden behind macros because later versions of GCC won't need this workaround: they can be told to use the unified syntax with -masm-syntax-unified. Change-Id: Ic09e729e5bbb6fd44d08dac348daf6f55c75d7d8
This commit is contained in:
parent
86429dbf1e
commit
58b2e45782
7 changed files with 28 additions and 9 deletions
|
|
@ -53,13 +53,14 @@ enum state_enum
|
|||
#define CMP_3_CONST(_a, _b) \
|
||||
({ int _x; \
|
||||
asm volatile ( \
|
||||
".syntax unified \n" \
|
||||
BEGIN_ARM_ASM_SYNTAX_UNIFIED \
|
||||
"ldrb %[x], [%[a], #0] \n" \
|
||||
"eors %[x], %[x], %[b0] \n" \
|
||||
"ldrbeq %[x], [%[a], #1] \n" \
|
||||
"eorseq %[x], %[x], %[b1] \n" \
|
||||
"ldrbeq %[x], [%[a], #2] \n" \
|
||||
"eorseq %[x], %[x], %[b2] \n" \
|
||||
END_ARM_ASM_SYNTAX_UNIFIED \
|
||||
: [x]"=&r"(_x) \
|
||||
: [a]"r"(_a), \
|
||||
[b0]"i"(((_b) >> 24) & 0xff), \
|
||||
|
|
@ -71,7 +72,7 @@ enum state_enum
|
|||
#define CMP_4_CONST(_a, _b) \
|
||||
({ int _x; \
|
||||
asm volatile ( \
|
||||
".syntax unified \n" \
|
||||
BEGIN_ARM_ASM_SYNTAX_UNIFIED \
|
||||
"ldrb %[x], [%[a], #0] \n" \
|
||||
"eors %[x], %[x], %[b0] \n" \
|
||||
"ldrbeq %[x], [%[a], #1] \n" \
|
||||
|
|
@ -80,6 +81,7 @@ enum state_enum
|
|||
"eorseq %[x], %[x], %[b2] \n" \
|
||||
"ldrbeq %[x], [%[a], #3] \n" \
|
||||
"eorseq %[x], %[x], %[b3] \n" \
|
||||
END_ARM_ASM_SYNTAX_UNIFIED \
|
||||
: [x]"=&r"(_x) \
|
||||
: [a]"r"(_a), \
|
||||
[b0]"i"(((_b) >> 24) & 0xff), \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue