Message ID | 20211215084500.24444-2-huangpei@loongson.cn (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | [1/4] MIPS: fix local_{add,sub}_return on MIPS64 | expand |
On Wed, Dec 15, 2021 at 04:44:57PM +0800, Huang Pei wrote: > Use "daddu/dsubu" for long int on MIPS64 instead of "addu/subu" > > Fixes: 7232311ef14c ("local_t: mips extension") > Signed-off-by: Huang Pei <huangpei@loongson.cn> > --- > arch/mips/include/asm/llsc.h | 4 ++++ > arch/mips/include/asm/local.h | 8 ++++---- > 2 files changed, 8 insertions(+), 4 deletions(-) > > diff --git a/arch/mips/include/asm/llsc.h b/arch/mips/include/asm/llsc.h > index ec09fe5d6d6c..8cc28177c37f 100644 > --- a/arch/mips/include/asm/llsc.h > +++ b/arch/mips/include/asm/llsc.h > @@ -14,10 +14,14 @@ > #if _MIPS_SZLONG == 32 > #define __LL "ll " > #define __SC "sc " > +#define __ADDU "addu " > +#define __SUBU "subu " > #define __INS "ins " > #define __EXT "ext " > #elif _MIPS_SZLONG == 64 > #define __LL "lld " > +#define __ADDU "daddu " > +#define __SUBU "dsubu " > #define __SC "scd " > #define __INS "dins " > #define __EXT "dext " maybe I wasn't clear enough, I don't want your orginal fix, but use fix patch using __stringify(LONG_ADDU)/__stringify(LONG_SUBU). Thomas.
On Thu, Dec 16, 2021 at 01:49:48PM +0100, Thomas Bogendoerfer wrote: > On Wed, Dec 15, 2021 at 04:44:57PM +0800, Huang Pei wrote: > > Use "daddu/dsubu" for long int on MIPS64 instead of "addu/subu" > > > > Fixes: 7232311ef14c ("local_t: mips extension") > > Signed-off-by: Huang Pei <huangpei@loongson.cn> > > --- > > arch/mips/include/asm/llsc.h | 4 ++++ > > arch/mips/include/asm/local.h | 8 ++++---- > > 2 files changed, 8 insertions(+), 4 deletions(-) > > > > diff --git a/arch/mips/include/asm/llsc.h b/arch/mips/include/asm/llsc.h > > index ec09fe5d6d6c..8cc28177c37f 100644 > > --- a/arch/mips/include/asm/llsc.h > > +++ b/arch/mips/include/asm/llsc.h > > @@ -14,10 +14,14 @@ > > #if _MIPS_SZLONG == 32 > > #define __LL "ll " > > #define __SC "sc " > > +#define __ADDU "addu " > > +#define __SUBU "subu " > > #define __INS "ins " > > #define __EXT "ext " > > #elif _MIPS_SZLONG == 64 > > #define __LL "lld " > > +#define __ADDU "daddu " > > +#define __SUBU "dsubu " > > #define __SC "scd " > > #define __INS "dins " > > #define __EXT "dext " > > maybe I wasn't clear enough, I don't want your orginal fix, but use > fix patch using __stringify(LONG_ADDU)/__stringify(LONG_SUBU). > > Thomas. > My point is to keep code style in consistency. If you insist, you can fix it by yourself. It is ok, I don't mind. > -- > Crap can work. Given enough thrust pigs will fly, but it's not necessarily a > good idea. [ RFC1925, 2.3 ]
On Sat, Dec 18, 2021 at 11:23:12AM +0800, Huang Pei wrote: > On Thu, Dec 16, 2021 at 01:49:48PM +0100, Thomas Bogendoerfer wrote: > > On Wed, Dec 15, 2021 at 04:44:57PM +0800, Huang Pei wrote: > > > Use "daddu/dsubu" for long int on MIPS64 instead of "addu/subu" > > > > > > Fixes: 7232311ef14c ("local_t: mips extension") > > > Signed-off-by: Huang Pei <huangpei@loongson.cn> > > > --- > > > arch/mips/include/asm/llsc.h | 4 ++++ > > > arch/mips/include/asm/local.h | 8 ++++---- > > > 2 files changed, 8 insertions(+), 4 deletions(-) > > > > > > diff --git a/arch/mips/include/asm/llsc.h b/arch/mips/include/asm/llsc.h > > > index ec09fe5d6d6c..8cc28177c37f 100644 > > > --- a/arch/mips/include/asm/llsc.h > > > +++ b/arch/mips/include/asm/llsc.h > > > @@ -14,10 +14,14 @@ > > > #if _MIPS_SZLONG == 32 > > > #define __LL "ll " > > > #define __SC "sc " > > > +#define __ADDU "addu " > > > +#define __SUBU "subu " > > > #define __INS "ins " > > > #define __EXT "ext " > > > #elif _MIPS_SZLONG == 64 > > > #define __LL "lld " > > > +#define __ADDU "daddu " > > > +#define __SUBU "dsubu " > > > #define __SC "scd " > > > #define __INS "dins " > > > #define __EXT "dext " > > > > maybe I wasn't clear enough, I don't want your orginal fix, but use > > fix patch using __stringify(LONG_ADDU)/__stringify(LONG_SUBU). > > > > Thomas. > > > My point is to keep code style in consistency. If you insist, you can > fix it by yourself. It is ok, I don't mind. sorry for causing such frustration on your side. I've applied diff --git a/arch/mips/include/asm/local.h b/arch/mips/include/asm/local.h index ecda7295ddcd..3fa634090388 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,7 +40,7 @@ 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" + __stringify(LONG_ADDU) " %0, %1, %3 \n" __SC "%0, %2 \n" " beqzl %0, 1b \n" " addu %0, %1, %3 \n" @@ -55,7 +56,7 @@ 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" + __stringify(LONG_ADDU) " %0, %1, %3 \n" __SC "%0, %2 \n" " beqz %0, 1b \n" " addu %0, %1, %3 \n" @@ -88,7 +89,7 @@ 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" + __stringify(LONG_SUBU) " %0, %1, %3 \n" __SC "%0, %2 \n" " beqzl %0, 1b \n" " subu %0, %1, %3 \n" @@ -104,7 +105,7 @@ 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" + __stringify(LONG_SUBU) " %0, %1, %3 \n" __SC "%0, %2 \n" " beqz %0, 1b \n" " subu %0, %1, %3 \n" and the reason is I prefer to keep the changes as small and local as possible. This makes the reviews and applying to older trees easier. Thomas.
diff --git a/arch/mips/include/asm/llsc.h b/arch/mips/include/asm/llsc.h index ec09fe5d6d6c..8cc28177c37f 100644 --- a/arch/mips/include/asm/llsc.h +++ b/arch/mips/include/asm/llsc.h @@ -14,10 +14,14 @@ #if _MIPS_SZLONG == 32 #define __LL "ll " #define __SC "sc " +#define __ADDU "addu " +#define __SUBU "subu " #define __INS "ins " #define __EXT "ext " #elif _MIPS_SZLONG == 64 #define __LL "lld " +#define __ADDU "daddu " +#define __SUBU "dsubu " #define __SC "scd " #define __INS "dins " #define __EXT "dext " diff --git a/arch/mips/include/asm/local.h b/arch/mips/include/asm/local.h index ecda7295ddcd..608651d9affe 100644 --- a/arch/mips/include/asm/local.h +++ b/arch/mips/include/asm/local.h @@ -39,7 +39,7 @@ 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" @@ -55,7 +55,7 @@ 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" @@ -88,7 +88,7 @@ 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" @@ -104,7 +104,7 @@ 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"
Use "daddu/dsubu" for long int on MIPS64 instead of "addu/subu" Fixes: 7232311ef14c ("local_t: mips extension") Signed-off-by: Huang Pei <huangpei@loongson.cn> --- arch/mips/include/asm/llsc.h | 4 ++++ arch/mips/include/asm/local.h | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-)