Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp12512043rwd; Fri, 23 Jun 2023 07:09:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Q7AkMkdMImiUXa49GMu3PiECze4EZWA11CPsHsDt5YMW0KvVYbBC9f0b4458ZHrgRSk6m X-Received: by 2002:a92:90f:0:b0:33d:85c3:93ee with SMTP id y15-20020a92090f000000b0033d85c393eemr24559232ilg.17.1687529347380; Fri, 23 Jun 2023 07:09:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687529347; cv=none; d=google.com; s=arc-20160816; b=oLMRc+GTHF5bAKOntH5Spo4lGASRK9gavOvMKTxuBPYrne8Y4EWQ2cpngi7hKdMyc0 TNE2vtfg5e0wJaGrKv28vGxj6RMSwMegXVtjV2eespbTTVI+G+NO4ZLjL76JzLxqgq6Z zjp4KgIRXYCTZbkLnFnG3BLwXmxW8GXjqs2yjJ3z4Vsz2fhDNgAZR9TuGTNtESVafTXu C7HZ5qlEoD3MsBNw9DtwAuS/XT/1cgxoDtfDWzh2VGuTKoseW5tUL2B5C+3HBptUL8Y2 KqITDd17vvwgtu5GRq2fIT+Rt3zkUcZAGhkpyTgtnZkipbeehZKjXhmB4+VTWhTqMwU5 lSiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GxJfFgKiYTaYJl8vqHEgSxwiS5Uw8l4Axrfxt/ILj7M=; b=wmTSeag9WJdXw/46dn+UexcieP4JwTd4qzG8YteeJDopdGDQrY5JEnisql8rGCoI4b EKo9xjN5w9Ey4d/FVf+t8ZlD/PwnYCzzWbzBbdnYuUNFvHihrwesV3cRbj9cgvPMi2YP icA14fdjPBXKvCo8LQqGPmRKK5KtgvihgmgNlfSj/O6fGTHw6JSFHPMB3c8whyTcz1fb C5nR7TIKQCQXX3k+lCvCEoiy/jIL0OQHbvyYgy83UPB2TFsTZUswuEeSzI0zSX3ecZ9F 8o2lVj/pmxV9C3QlP0KNwmmT5BxiShH4L+ikkk7mtWCSj848EHoEMxwxrcqC59sJyZnk sgaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xen0n.name header.s=mail header.b=FnGl2zpN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b7-20020a656687000000b0054f904a0a0dsi8916324pgw.624.2023.06.23.07.08.28; Fri, 23 Jun 2023 07:09:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@xen0n.name header.s=mail header.b=FnGl2zpN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231773AbjFWNoV (ORCPT + 99 others); Fri, 23 Jun 2023 09:44:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229647AbjFWNoN (ORCPT ); Fri, 23 Jun 2023 09:44:13 -0400 Received: from mailbox.box.xen0n.name (mail.xen0n.name [115.28.160.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B75FA2688; Fri, 23 Jun 2023 06:44:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xen0n.name; s=mail; t=1687527850; bh=I9sBWXJarUacmT9tJVRaaV9L2voiD3I9Gx59y+JU7NY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FnGl2zpNJcTOSoS6xm5nWi8rAtAahvSAYEgKmfK0DBi0WiLoKBbB/7sBsR7XOPXo+ P2ZfadFDDkDGkOQDEgdxm1y5Ur8ETZRC959WDAeAFuKU3PPeu8fuhMgcKZ+Jr094S/ i+oScUM/oUUXFDKK/KJq+8/OapsFgD+h+JjF4tu8= Received: from ld50.lan (unknown [101.88.25.181]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mailbox.box.xen0n.name (Postfix) with ESMTPSA id 7E1EC605E0; Fri, 23 Jun 2023 21:44:10 +0800 (CST) From: WANG Xuerui To: Huacai Chen Cc: WANG Rui , Xi Ruoyao , loongarch@lists.linux.dev, linux-kbuild@vger.kernel.org, llvm@lists.linux.dev, linux-kernel@vger.kernel.org, WANG Xuerui Subject: [PATCH 3/9] LoongArch: Prepare for assemblers with proper FCSR bank support Date: Fri, 23 Jun 2023 21:43:45 +0800 Message-Id: <20230623134351.1898379-4-kernel@xen0n.name> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230623134351.1898379-1-kernel@xen0n.name> References: <20230623134351.1898379-1-kernel@xen0n.name> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: WANG Xuerui The GNU assembler (as of 2.40) mis-treats FCSR operands as GPRs, but the LLVM IAS does not. Probe for this and refer to FCSRs as "$fcsrNN" if support is present. Signed-off-by: WANG Xuerui --- arch/loongarch/Kconfig | 3 +++ arch/loongarch/include/asm/fpregdef.h | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig index 743d87655742..c8e4f8b03c55 100644 --- a/arch/loongarch/Kconfig +++ b/arch/loongarch/Kconfig @@ -242,6 +242,9 @@ config SCHED_OMIT_FRAME_POINTER config AS_HAS_EXPLICIT_RELOCS def_bool $(as-instr,x:pcalau12i \$t0$(comma)%pc_hi20(x)) +config AS_HAS_FCSR_BANK + def_bool $(as-instr,x:movfcsr2gr \$t0$(comma)\$fcsr0) + config CC_HAS_LSX_EXTENSION def_bool $(cc-option,-mlsx) diff --git a/arch/loongarch/include/asm/fpregdef.h b/arch/loongarch/include/asm/fpregdef.h index b6be527831dd..b0ac640db74c 100644 --- a/arch/loongarch/include/asm/fpregdef.h +++ b/arch/loongarch/include/asm/fpregdef.h @@ -40,6 +40,12 @@ #define fs6 $f30 #define fs7 $f31 +#ifdef CONFIG_AS_HAS_FCSR_BANK +#define fcsr0 $fcsr0 +#define fcsr1 $fcsr1 +#define fcsr2 $fcsr2 +#define fcsr3 $fcsr3 +#else /* * Current binutils expects *GPRs* at FCSR position for the FCSR * operation instructions, so define aliases for those used. @@ -48,5 +54,6 @@ #define fcsr1 $r1 #define fcsr2 $r2 #define fcsr3 $r3 +#endif #endif /* _ASM_FPREGDEF_H */ -- 2.40.0