From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by sourceware.org (Postfix) with ESMTP id CA8323858CD9 for ; Sun, 26 May 2024 06:15:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CA8323858CD9 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=loongson.cn ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CA8323858CD9 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=114.242.206.163 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716704142; cv=none; b=YQsFZJlnnYGGemZlUn2pjjPr4OJXOt2aYfjjCzhiKggowGaMu32N/ze6yv9s9/9Dv4CYWlZdZ8KXFLiNKmNqklp7V6PQkqaqHwW0VvsQIimVFk/mSHG9teZwWYrZEy74qPqddmtO3CVx9lQgVxNYv87QDE64mrwyIslZLYtW/jU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716704142; c=relaxed/simple; bh=SGux2VdsMAVwKB8OvkmEMM5htlFB0z40KZSekXOMI+E=; h=Subject:To:From:Message-ID:Date:MIME-Version; b=B6aBhB34rPsS+MOxuwh0pKcq8gFaJ1CQYCU89IeAdMzf5XAsq03wWtkZttP62upx+D6fSFmNmWvCZ/DL3EXizoK9J+mq8uIaVny/vjXXv2vgOetKck+sItUZ9Ri/iokSSHHHsK9tmALec+ukEpi6O0I+SNMswRr5NC/A/r1v9wg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from loongson.cn (unknown [10.20.4.90]) by gateway (Coremail) with SMTP id _____8Cx6+qH01JmNt8DAA--.7975S3; Sun, 26 May 2024 14:15:36 +0800 (CST) Received: from [10.20.4.90] (unknown [10.20.4.90]) by localhost.localdomain (Coremail) with SMTP id AQAAf8BxFMWG01Jm+L4JAA--.1985S2; Sun, 26 May 2024 14:15:34 +0800 (CST) Subject: Re: [PATCH] LoongArch: Use "$fcsr0" instead of "$r0" in _FPU_{GET,SET}CW To: Adhemerval Zanella Netto , Xi Ruoyao , libc-alpha@sourceware.org Cc: WANG Xuerui , luweining@loongson.cn References: <20240429073111.14572-2-xry111@xry111.site> From: caiyinyu Message-ID: Date: Sun, 26 May 2024 14:15:34 +0800 User-Agent: Mozilla/5.0 (X11; Linux loongarch64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-CM-TRANSID:AQAAf8BxFMWG01Jm+L4JAA--.1985S2 X-CM-SenderInfo: 5fdl5xhq1xqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBj93XoW7WF47tFWrGr4rXrW3WF4DGFX_yoW8KF47pr y3CF9xCF4UCw4Ygayvyw15X3ZaqF93GF97WrsxAr18Gr1av3WjqrWI9rsYgFyDZwn7Xr1I vr48WasagF4DJ3gCm3ZEXasCq-sJn29KB7ZKAUJUUUUr529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUBjb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r106r15M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Jr0_JF4l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Jr0_Gr1l84ACjcxK6I8E87Iv67AKxVW8JVWxJwA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_ Gr0_Gr1UM2kKe7AKxVWUXVWUAwAS0I0E0xvYzxvE52x082IY62kv0487Mc804VCY07AIYI kI8VC2zVCFFI0UMc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUXVWU AwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcVAKI48JMx k0xIA0c2IEe2xFo4CEbIxvr21l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_ Gr1l4IxYO2xFxVAFwI0_Jrv_JF1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67 AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8I cVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE42xK8VAvwI 8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v2 6r1j6r4UYxBIdaVFxhVjvjDU0xZFpf9x07je0PfUUUUU= X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_STATUS,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 在 2024/5/23 下午9:09, Adhemerval Zanella Netto 写道: > > On 29/04/24 04:31, Xi Ruoyao wrote: >> Clang inline-asm parser does not allow using "$r0" in >> movfcsr2gr/movgr2fcsr, so everything using _FPU_{GET,SET}CW is now >> failing to build with Clang on LoongArch. As we now requires Binutils >>> = 2.41 which supports using "$fcsr0" here, use it instead of "$r0" to >> fix the issue. >> >> Link: https://github.com/loongson-community/discussions/issues/53#issuecomment-2081507390 >> Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=4142b2368353 >> Signed-off-by: Xi Ruoyao > LGTM, thanks. It is safe to use with old gcc and binutils or the new > constraint required a specific gcc version? 1.  Starting from LoongArch glibc-2.39, the minimum required version of binutils is 2.41(because of the LASX/LSX vector instructions), and binutils support for this modification also begins with version 2.41 2.  All LoongArch gcc support this change. The header files modified this time are export header files, but I think this change is ok.  In conclusion, I plan to merge this commit. >> --- >> >> People in the Cc list will receive this twice because I've mistyped the >> address of libc-alpha first time. Sorry. Stupid I :(. >> >> sysdeps/loongarch/fpu_control.h | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/sysdeps/loongarch/fpu_control.h b/sysdeps/loongarch/fpu_control.h >> index 54add4e01c..3cdf2417d9 100644 >> --- a/sysdeps/loongarch/fpu_control.h >> +++ b/sysdeps/loongarch/fpu_control.h >> @@ -91,8 +91,8 @@ typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__SI__))); >> /* Macros for accessing the hardware control word. */ >> extern fpu_control_t __loongarch_fpu_getcw (void) __THROW; >> extern void __loongarch_fpu_setcw (fpu_control_t) __THROW; >> -#define _FPU_GETCW(cw) __asm__ volatile ("movfcsr2gr %0,$r0" : "=r"(cw)) >> -#define _FPU_SETCW(cw) __asm__ volatile ("movgr2fcsr $r0,%0" : : "r"(cw)) >> +#define _FPU_GETCW(cw) __asm__ volatile ("movfcsr2gr %0,$fcsr0" : "=r"(cw)) >> +#define _FPU_SETCW(cw) __asm__ volatile ("movgr2fcsr $fcsr0,%0" : : "r"(cw)) >> >> /* Default control word set at startup. */ >> extern fpu_control_t __fpu_control;