From patchwork Wed Dec 15 08:44:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Pei X-Patchwork-Id: 12677761 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30B46C433F5 for ; Wed, 15 Dec 2021 08:45:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240898AbhLOIpW (ORCPT ); Wed, 15 Dec 2021 03:45:22 -0500 Received: from mail.loongson.cn ([114.242.206.163]:38792 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231561AbhLOIpU (ORCPT ); Wed, 15 Dec 2021 03:45:20 -0500 Received: from localhost.localdomain (unknown [111.9.175.10]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9DxrNwUq7lh0P4AAA--.1916S3; Wed, 15 Dec 2021 16:45:13 +0800 (CST) From: Huang Pei To: Thomas Bogendoerfer , ambrosehua@gmail.com Cc: Bibo Mao , linux-mips@vger.kernel.org, Jiaxun Yang , Paul Burton , Li Xuefeng , Yang Tiezhu , Gao Juxin , Huacai Chen Subject: [PATCH 1/4] MIPS: fix local_{add,sub}_return on MIPS64 Date: Wed, 15 Dec 2021 16:44:57 +0800 Message-Id: <20211215084500.24444-2-huangpei@loongson.cn> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211215084500.24444-1-huangpei@loongson.cn> References: <20211215084500.24444-1-huangpei@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAf9DxrNwUq7lh0P4AAA--.1916S3 X-Coremail-Antispam: 1UD129KBjvJXoW7ArW3WFy7WF1kZF43Kr1Dtrb_yoW8tr4kpF WDCas7KFWqgFyxGasIkFWSkr43u3y5GrZa9Fy09r9FyF9aqwnrtrZ7K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mips@vger.kernel.org Use "daddu/dsubu" for long int on MIPS64 instead of "addu/subu" Fixes: 7232311ef14c ("local_t: mips extension") Signed-off-by: Huang Pei --- 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 " 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"