All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MIPS: fix local_t operation on MIPS64
@ 2021-09-04 15:12 Huang Pei
  2021-09-04 17:57   ` Maciej W. Rozycki
                   ` (3 more replies)
  0 siblings, 4 replies; 18+ messages in thread
From: Huang Pei @ 2021-09-04 15:12 UTC (permalink / raw)
  To: Thomas Bogendoerfer, ambrosehua
  Cc: Bibo Mao, linux-mips, linux-arch, linux-mm, Jiaxun Yang,
	Paul Burton, Li Xuefeng, Yang Tiezhu, Gao Juxin, Huacai Chen,
	Jinyang He, Maciej W . Rozycki, Steven Rostedt, Jisheng Zhang,
	Masami Hiramatsu

Use daddu/dsubu for long int on MIPS64.

Signed-off-by: Huang Pei <huangpei@loongson.cn>
---
 arch/mips/include/asm/llsc.h  |  4 ++++
 arch/mips/include/asm/local.h | 17 +++++++++--------
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/arch/mips/include/asm/llsc.h b/arch/mips/include/asm/llsc.h
index ec09fe5d6d6c..788e26ad7fca 100644
--- a/arch/mips/include/asm/llsc.h
+++ b/arch/mips/include/asm/llsc.h
@@ -16,11 +16,15 @@
 #define __SC		"sc	"
 #define __INS		"ins	"
 #define __EXT		"ext	"
+#define __ADDU		"addu	"
+#define __SUBU		"subu	"
 #elif _MIPS_SZLONG == 64
 #define __LL		"lld	"
 #define __SC		"scd	"
 #define __INS		"dins	"
 #define __EXT		"dext	"
+#define __ADDU		"daddu	"
+#define __SUBU		"dsubu	"
 #endif
 
 /*
diff --git a/arch/mips/include/asm/local.h b/arch/mips/include/asm/local.h
index ecda7295ddcd..3c6db82ee0a6 100644
--- a/arch/mips/include/asm/local.h
+++ b/arch/mips/include/asm/local.h
@@ -5,6 +5,7 @@
 #include <linux/percpu.h>
 #include <linux/bitops.h>
 #include <linux/atomic.h>
+#include <asm/asm.h>
 #include <asm/cmpxchg.h>
 #include <asm/compiler.h>
 #include <asm/war.h>
@@ -39,10 +40,10 @@ static __inline__ long local_add_return(long i, local_t * l)
 		"	.set	arch=r4000				\n"
 			__SYNC(full, loongson3_war) "			\n"
 		"1:"	__LL	"%1, %2		# local_add_return	\n"
-		"	addu	%0, %1, %3				\n"
+			__ADDU	"%0, %1, %3				\n"
 			__SC	"%0, %2					\n"
 		"	beqzl	%0, 1b					\n"
-		"	addu	%0, %1, %3				\n"
+			__ADDU	"%0, %1, %3				\n"
 		"	.set	pop					\n"
 		: "=&r" (result), "=&r" (temp), "=m" (l->a.counter)
 		: "Ir" (i), "m" (l->a.counter)
@@ -55,10 +56,10 @@ static __inline__ long local_add_return(long i, local_t * l)
 		"	.set	"MIPS_ISA_ARCH_LEVEL"			\n"
 			__SYNC(full, loongson3_war) "			\n"
 		"1:"	__LL	"%1, %2		# local_add_return	\n"
-		"	addu	%0, %1, %3				\n"
+			__ADDU	"%0, %1, %3				\n"
 			__SC	"%0, %2					\n"
 		"	beqz	%0, 1b					\n"
-		"	addu	%0, %1, %3				\n"
+			__ADDU	"%0, %1, %3				\n"
 		"	.set	pop					\n"
 		: "=&r" (result), "=&r" (temp), "=m" (l->a.counter)
 		: "Ir" (i), "m" (l->a.counter)
@@ -88,10 +89,10 @@ static __inline__ long local_sub_return(long i, local_t * l)
 		"	.set	arch=r4000				\n"
 			__SYNC(full, loongson3_war) "			\n"
 		"1:"	__LL	"%1, %2		# local_sub_return	\n"
-		"	subu	%0, %1, %3				\n"
+			__SUBU	"%0, %1, %3				\n"
 			__SC	"%0, %2					\n"
 		"	beqzl	%0, 1b					\n"
-		"	subu	%0, %1, %3				\n"
+			__SUBU	"%0, %1, %3				\n"
 		"	.set	pop					\n"
 		: "=&r" (result), "=&r" (temp), "=m" (l->a.counter)
 		: "Ir" (i), "m" (l->a.counter)
@@ -104,10 +105,10 @@ static __inline__ long local_sub_return(long i, local_t * l)
 		"	.set	"MIPS_ISA_ARCH_LEVEL"			\n"
 			__SYNC(full, loongson3_war) "			\n"
 		"1:"	__LL	"%1, %2		# local_sub_return	\n"
-		"	subu	%0, %1, %3				\n"
+			__SUBU	"%0, %1, %3				\n"
 			__SC	"%0, %2					\n"
 		"	beqz	%0, 1b					\n"
-		"	subu	%0, %1, %3				\n"
+			__SUBU	"%0, %1, %3				\n"
 		"	.set	pop					\n"
 		: "=&r" (result), "=&r" (temp), "=m" (l->a.counter)
 		: "Ir" (i), "m" (l->a.counter)
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2021-09-08  8:15 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-04 15:12 [PATCH] MIPS: fix local_t operation on MIPS64 Huang Pei
2021-09-04 17:57 ` Maciej W. Rozycki
2021-09-04 17:57   ` Maciej W. Rozycki
2021-09-05  0:48   ` 黄沛
2021-09-06 11:08     ` Maciej W. Rozycki
2021-09-06 11:08       ` Maciej W. Rozycki
2021-09-06 14:03       ` Huang Pei
2021-09-06 16:29         ` Maciej W. Rozycki
2021-09-06 16:29           ` Maciej W. Rozycki
     [not found]           ` <6113C299-3E26-4445-97FD-32690FD91C95@loongson.cn>
2021-09-07 10:00             ` Maciej W. Rozycki
2021-09-07 10:00               ` Maciej W. Rozycki
2021-09-08  8:15               ` 黄沛
2021-09-04 18:50 ` kernel test robot
2021-09-04 18:50   ` kernel test robot
2021-09-04 19:10 ` kernel test robot
2021-09-04 19:10   ` kernel test robot
2021-09-05  3:42 ` kernel test robot
2021-09-05  3:42   ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.