Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2991620ybv; Mon, 24 Feb 2020 15:58:31 -0800 (PST) X-Google-Smtp-Source: APXvYqxLxjjglEEJoSSB66+Af04lqMFrShvBaiI0YuOjY1UoKu3z9T1VIRIQl1f5M1e6lc8H5OYm X-Received: by 2002:a05:6808:1d3:: with SMTP id x19mr1331765oic.77.1582588711383; Mon, 24 Feb 2020 15:58:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582588711; cv=none; d=google.com; s=arc-20160816; b=cV+6Koegq6l26OqXJtAMGbLtge0xh9JgZCD1WiJt9ZZ9MfYT75QAifVnD7dBRB97LL 6Ohzt5CJC4X8R8WgNUwhp2PUVMg2tjCChFEl6rhIiOocyJKoxka2c9UqSyWQFs7nqoFv IHsLnoMmEAUr1vZHCwMYivgq4VkjtgitiNFtFFaS6By2ee4oMXXHa3w8IH+PsAMb06FC clwcwM060CR5SCbNl9cfZsOkUwBnfuAPfzqWiDYUYmOY6q/L3MmDhfVpDimcisLjdeev Nr6bl8aYjpRu/2CqjAcAmgxIm/JKAC0hfyuY3EnHIfdL43MMGLuctyTfOeQ78Xdn9ooN YCyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=knLzyUSaJSbGxSDiQWBKWSmgmd9VevAPMusi7YBYNHE=; b=DPoPpmkc+0/Pc95WY4o9hYy/2V4qVNceoIRpTLhA+QQAW9Z8GSwx2HKAGAC1zMjKxm x99NU6rKug4SJsV1i+M5vnNRAMBHDnM+CVcSpMA/ScZxMFYMh4t3HVyk73T1uEy59uuy WasAJLpUGyClXGjcsQ5HcU4j0yC+1PYkSOayfOiCQ1HYqYOaRpHrCD5njLoESCR28e6O ISjYqpvgEFIJoo+LOg/cfKK9T9gxYSQUr7b570b2l/hU1MKRIkQIUyyzENwpfe0U2sD6 mvi0dtYUkuWduUST069GYBehQClBGRyQZaSJih3pFolW7nuNo5TH6zmkYUKHeFCql8DX n/hA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@agner.ch header.s=dkim header.b=ceeCpOs0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d14si5293887oic.201.2020.02.24.15.58.19; Mon, 24 Feb 2020 15:58:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@agner.ch header.s=dkim header.b=ceeCpOs0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728424AbgBXX5J (ORCPT + 99 others); Mon, 24 Feb 2020 18:57:09 -0500 Received: from mail.kmu-office.ch ([178.209.48.109]:38302 "EHLO mail.kmu-office.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726651AbgBXX5J (ORCPT ); Mon, 24 Feb 2020 18:57:09 -0500 Received: from zyt.lan (unknown [IPv6:2a02:169:3df5::564]) by mail.kmu-office.ch (Postfix) with ESMTPSA id 667575C4EBF; Tue, 25 Feb 2020 00:57:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1582588627; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=knLzyUSaJSbGxSDiQWBKWSmgmd9VevAPMusi7YBYNHE=; b=ceeCpOs0KDH76Fhq1yqjouLmKosOdGCevr1YfOv4yVjc8Z+OsDMJwrNk6say9sS1HJ/wmm eVdwfy/QLoagc0p2slD6o4t9+eTdOq6u/MVGyTs9ScrjpKXY7WkgphAb9iB88PMxDBpoiL JBVu74Lybsi108UWChsqo1JKUK5xrSc= From: Stefan Agner To: linux@armlinux.org.uk Cc: arnd@arndb.de, manojgupta@google.com, jiancai@google.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Stefan Agner Subject: [PATCH] ARM: use assembly mnemonics for VFP register access Date: Fri, 21 Feb 2020 07:34:21 +0100 Message-Id: <8bb16ac4b15a7e28a8e819ef9aae20bfc3f75fbc.1582266841.git.stefan@agner.ch> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Clang's integrated assembler does not allow to to use the mcr instruction to access floating point co-processor registers: arch/arm/vfp/vfpmodule.c:342:2: error: invalid operand for instruction fmxr(FPEXC, fpexc & ~(FPEXC_EX|FPEXC_DEX|FPEXC_FP2V|FPEXC_VV|FPEXC_TRAP_MASK)); ^ arch/arm/vfp/vfpinstr.h:79:6: note: expanded from macro 'fmxr' asm("mcr p10, 7, %0, " vfpreg(_vfp_) ", cr0, 0 @ fmxr " #_vfp_ ", %0" \ ^ :1:6: note: instantiated into assembly here mcr p10, 7, r0, cr8, cr0, 0 @ fmxr FPEXC, r0 ^ The GNU assembler supports the .fpu directive at least since 2.17 (when documentation has been added). Since Linux requires binutils 2.21 it is safe to use .fpu directive. Use the .fpu directive and mnemonics for VFP register access. This allows to build vfpmodule.c with Clang and its integrated assembler. Link: https://github.com/ClangBuiltLinux/linux/issues/905 Signed-off-by: Stefan Agner --- arch/arm/vfp/vfpinstr.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/arch/arm/vfp/vfpinstr.h b/arch/arm/vfp/vfpinstr.h index 38dc154e39ff..799ccf065406 100644 --- a/arch/arm/vfp/vfpinstr.h +++ b/arch/arm/vfp/vfpinstr.h @@ -62,21 +62,17 @@ #define FPSCR_C (1 << 29) #define FPSCR_V (1 << 28) -/* - * Since we aren't building with -mfpu=vfp, we need to code - * these instructions using their MRC/MCR equivalents. - */ -#define vfpreg(_vfp_) #_vfp_ - #define fmrx(_vfp_) ({ \ u32 __v; \ - asm("mrc p10, 7, %0, " vfpreg(_vfp_) ", cr0, 0 @ fmrx %0, " #_vfp_ \ + asm(".fpu vfpv2\n" \ + "vmrs %0, " #_vfp_ \ : "=r" (__v) : : "cc"); \ __v; \ }) #define fmxr(_vfp_,_var_) \ - asm("mcr p10, 7, %0, " vfpreg(_vfp_) ", cr0, 0 @ fmxr " #_vfp_ ", %0" \ + asm(".fpu vfpv2\n" \ + "vmsr " #_vfp_ ", %0" \ : : "r" (_var_) : "cc") u32 vfp_single_cpdo(u32 inst, u32 fpscr); -- 2.25.1