diff mbox series

[v2,3/3] ARM: spinlock: use unified assembler language syntax

Message ID ad0fbab91f337ec99e3a2a3d60886a785da34366.1546551693.git.stefan@agner.ch (mailing list archive)
State Mainlined, archived
Commit eb7ff9023e4f2998d527b37bffe794759800332a
Headers show
Series ARM: trivial assembly fixes to enable LLVM as | expand

Commit Message

Stefan Agner Jan. 3, 2019, 9:48 p.m. UTC
Convert the conditional infix to a postfix to make sure this inline
assembly is unified syntax. Since gcc assumes non-unified syntax
when emitting ARM instructions, make sure to define the syntax as
unified.

This allows to use LLVM's integrated assembler.

Signed-off-by: Stefan Agner <stefan@agner.ch>
---
Changes since v1:
- Explicitly use unified syntax for inline assembly


 arch/arm/include/asm/spinlock.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Nicolas Pitre Jan. 5, 2019, 4:13 p.m. UTC | #1
On Thu, 3 Jan 2019, Stefan Agner wrote:

> Convert the conditional infix to a postfix to make sure this inline
> assembly is unified syntax. Since gcc assumes non-unified syntax
> when emitting ARM instructions, make sure to define the syntax as
> unified.
> 
> This allows to use LLVM's integrated assembler.

Same comment as for patch 2/3.


> 
> Signed-off-by: Stefan Agner <stefan@agner.ch>
> ---
> Changes since v1:
> - Explicitly use unified syntax for inline assembly
> 
> 
>  arch/arm/include/asm/spinlock.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/include/asm/spinlock.h b/arch/arm/include/asm/spinlock.h
> index 099c78fcf62d..8f009e788ad4 100644
> --- a/arch/arm/include/asm/spinlock.h
> +++ b/arch/arm/include/asm/spinlock.h
> @@ -210,11 +210,12 @@ static inline void arch_read_lock(arch_rwlock_t *rw)
>  
>  	prefetchw(&rw->lock);
>  	__asm__ __volatile__(
> +"	.syntax unified\n"
>  "1:	ldrex	%0, [%2]\n"
>  "	adds	%0, %0, #1\n"
>  "	strexpl	%1, %0, [%2]\n"
>  	WFE("mi")
> -"	rsbpls	%0, %1, #0\n"
> +"	rsbspl	%0, %1, #0\n"
>  "	bmi	1b"
>  	: "=&r" (tmp), "=&r" (tmp2)
>  	: "r" (&rw->lock)
> -- 
> 2.20.1
> 
>
diff mbox series

Patch

diff --git a/arch/arm/include/asm/spinlock.h b/arch/arm/include/asm/spinlock.h
index 099c78fcf62d..8f009e788ad4 100644
--- a/arch/arm/include/asm/spinlock.h
+++ b/arch/arm/include/asm/spinlock.h
@@ -210,11 +210,12 @@  static inline void arch_read_lock(arch_rwlock_t *rw)
 
 	prefetchw(&rw->lock);
 	__asm__ __volatile__(
+"	.syntax unified\n"
 "1:	ldrex	%0, [%2]\n"
 "	adds	%0, %0, #1\n"
 "	strexpl	%1, %0, [%2]\n"
 	WFE("mi")
-"	rsbpls	%0, %1, #0\n"
+"	rsbspl	%0, %1, #0\n"
 "	bmi	1b"
 	: "=&r" (tmp), "=&r" (tmp2)
 	: "r" (&rw->lock)