Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp629492pxb; Thu, 12 Nov 2020 12:09:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJwJNJkPTXe7KgNs5L+ipSoAPlVhIPtEsd6tyjOHoEZfWHlzhVasO9eisDbpnKyhVAVpdeG0 X-Received: by 2002:a19:c6d1:: with SMTP id w200mr405754lff.228.1605211769789; Thu, 12 Nov 2020 12:09:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605211769; cv=none; d=google.com; s=arc-20160816; b=CwMVikzKfmBWA78e3h12KdQ6IXIGCOBIH/ptGcOoYsZM4QZTJyQvbFCl8DDvfldJso YcGYxiiD+p6T+e6BPOkhXe8chp+n7Tl3cdz+jADDjIYreF/OKqub6wriB1Ff0bOAUlUd QMM66oukav1D1bNwtDg0lSi5ILyZmzou75LnvuC+lDpm5zGY/lJEFaRSfVCjzPSNjvop nMO3qN3OroccYMeS5jEE+ijq0gafBUEu3YgYIF9rzXloGueQJvP9yxiuzzB5G9yM+sZU mi1nLlBT0voXjNjqKOvT3K9UFWfS44xPm7jfyQLjilhLtw8lfuTnH33x15lsUT/XotuG U5oA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:cc:from:subject:references:mime-version :message-id:in-reply-to:date:sender:dkim-signature; bh=FGYxJIAG4esRLwE4g6/6d2GqFghqrj8MPyr2L5/Ef4g=; b=PuoztFe75wjSM6oTf/O5SoT5wO2NtFKr3fKQdIvEUfYahArzokFJ/Z7McWpMF4DMyh xgINsuGARHhaW5EuU2wVYYQ2fBvWTudxNsenMjYs9clGRYZ+dmBYU4Q8gpb+y6mFHSfA 0ZxV2YqctHLqqGD8YKaGK70moGeE3SNc1aahTKbynjdXvE/e/8qzUZQ2PGP11yVAQFSG a9SrsUbLOu8QnocyNkBpH+hvzYq89UrRnuxZwaMTIPZH8W7Ozg4kgp/XCDrBSKVzXDbh t2cG+Pi9yaKbxc1MtiUKwxeiLy7BWBIb6qndQdD197KmLQCyJP71OCuu7nodObKypB/N QykQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=shLV0fQ1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hs35si4493405ejc.312.2020.11.12.12.09.05; Thu, 12 Nov 2020 12:09:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=shLV0fQ1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726970AbgKLUH0 (ORCPT + 99 others); Thu, 12 Nov 2020 15:07:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726738AbgKLUH0 (ORCPT ); Thu, 12 Nov 2020 15:07:26 -0500 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B275AC0613D1 for ; Thu, 12 Nov 2020 12:07:24 -0800 (PST) Received: by mail-yb1-xb49.google.com with SMTP id g129so7588229ybf.20 for ; Thu, 12 Nov 2020 12:07:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:cc; bh=FGYxJIAG4esRLwE4g6/6d2GqFghqrj8MPyr2L5/Ef4g=; b=shLV0fQ1YwPMGvF0367B9kqS5L9pXtTRomLOzoLI5J4XgS6RDJO8T2atvIWz8hZJbl Yn/oM4RPubP2xZAfSVqOrncx/AUrvEDNPg3/7YxEXpJpfXRUmv6ynrGcOxZpaw6FmsPI hRT2m78O5VWKJjJGft5il10gIjAwl9EXhq48+PI3WO9iSfC05I3CgmMcD4yx5jjuBg0G mPTf43YhunEp4pYb1b9q/2PfZyImXQvPqdBbUcKmiJCe7uXt+XZannbGo5uBV+kUzEYs 68M5iJ6V296D/peDsjh/lTM5KZWkS+5JwBedPC+gq2IuVY0w1YtN+p34D7pFBpuFC/Cc WrSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:cc; bh=FGYxJIAG4esRLwE4g6/6d2GqFghqrj8MPyr2L5/Ef4g=; b=FOv5rdry+GeA9ig4yGcb5IYED/UFqGdWcSBj6I33rCQ4x5Udar+UMbE+PTZdGQnZ6Q 8Nx0Ze5k6Qr043qQmxvLkXibRGp8JrkJqnbnet/guAqMCyLepKxPcJTeAXGc24grShiG GPTEJQzLytyR5O9JnJNBXK1L+g1tCv1b7E26WSut3QbJpf3MluFRcuPmjLCXKH3lgAC+ TX1EAckw32EBz+ioyxXqYSNPrTrK8qeeQltnJ6+eNyXyXVkeX0VKloSC4rfzsAnHJt/0 CQu6bQOKXYou4wnNR7+YSuT3tzckK3E6GNc63OuMdoOsbdQWkgvfuJBBQ5AZiVap/sDH SPSA== X-Gm-Message-State: AOAM5328dRdXnC0q+L6rXMrGWoqHKiqzptmiACo1Z7VWBdLjqYamBIp1 NRQZb1tujW9qpZ11HZH+z31wtaTDTCvb Sender: "jiancai via sendgmr" X-Received: from jiancai.svl.corp.google.com ([2620:15c:2ce:0:f693:9fff:fef4:238b]) (user=jiancai job=sendgmr) by 2002:a25:5806:: with SMTP id m6mr1930447ybb.449.1605211643746; Thu, 12 Nov 2020 12:07:23 -0800 (PST) Date: Thu, 12 Nov 2020 12:07:17 -0800 In-Reply-To: <20201107001056.225807-1-jiancai@google.com> Message-Id: <20201112200718.2747316-1-jiancai@google.com> Mime-Version: 1.0 References: <20201107001056.225807-1-jiancai@google.com> X-Mailer: git-send-email 2.29.2.299.gdc1121823c-goog Subject: [PATCH v3] Make iwmmxt.S support Clang's integrated assembler From: Jian Cai Cc: ndesaulniers@google.com, ardb@kernel.org, manojgupta@google.com, llozano@google.com, clang-built-linux@googlegroups.com, Jian Cai , Russell King , Nathan Chancellor , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch replaces 6 IWMMXT instructions Clang's integrated assembler does not support in iwmmxt.S using macros, while making sure GNU assembler still emit the same instructions. This should be easier than providing full IWMMXT support in Clang. This is one of the last bits of kernel code that could be compiled but not assembled with clang. Once all of it works with IAS, we no longer need to special-case 32-bit Arm in Kbuild, or turn off CONFIG_IWMMXT when build-testing. "Intel Wireless MMX Technology - Developer Guide - August, 2002" should be referenced for the encoding schemes of these extensions. Link: https://github.com/ClangBuiltLinux/linux/issues/975 Suggested-by: Nick Desaulniers Suggested-by: Ard Biesheuvel Acked-by: Ard Biesheuvel Signed-off-by: Jian Cai --- Thanks Ard for the writeup. Changes v2 -> v3: Add rationale in the commit log to further highlight the necessity of this change based on ardb@kernel.org's suggestion. arch/arm/kernel/iwmmxt.S | 89 ++++++++++++++++++++-------------------- 1 file changed, 45 insertions(+), 44 deletions(-) diff --git a/arch/arm/kernel/iwmmxt.S b/arch/arm/kernel/iwmmxt.S index 0dcae787b004..d2b4ac06e4ed 100644 --- a/arch/arm/kernel/iwmmxt.S +++ b/arch/arm/kernel/iwmmxt.S @@ -16,6 +16,7 @@ #include #include #include +#include "iwmmxt.h" #if defined(CONFIG_CPU_PJ4) || defined(CONFIG_CPU_PJ4B) #define PJ4(code...) code @@ -113,33 +114,33 @@ concan_save: concan_dump: - wstrw wCSSF, [r1, #MMX_WCSSF] - wstrw wCASF, [r1, #MMX_WCASF] - wstrw wCGR0, [r1, #MMX_WCGR0] - wstrw wCGR1, [r1, #MMX_WCGR1] - wstrw wCGR2, [r1, #MMX_WCGR2] - wstrw wCGR3, [r1, #MMX_WCGR3] + wstrw wCSSF, r1, MMX_WCSSF + wstrw wCASF, r1, MMX_WCASF + wstrw wCGR0, r1, MMX_WCGR0 + wstrw wCGR1, r1, MMX_WCGR1 + wstrw wCGR2, r1, MMX_WCGR2 + wstrw wCGR3, r1, MMX_WCGR3 1: @ MUP? wRn tst r2, #0x2 beq 2f - wstrd wR0, [r1, #MMX_WR0] - wstrd wR1, [r1, #MMX_WR1] - wstrd wR2, [r1, #MMX_WR2] - wstrd wR3, [r1, #MMX_WR3] - wstrd wR4, [r1, #MMX_WR4] - wstrd wR5, [r1, #MMX_WR5] - wstrd wR6, [r1, #MMX_WR6] - wstrd wR7, [r1, #MMX_WR7] - wstrd wR8, [r1, #MMX_WR8] - wstrd wR9, [r1, #MMX_WR9] - wstrd wR10, [r1, #MMX_WR10] - wstrd wR11, [r1, #MMX_WR11] - wstrd wR12, [r1, #MMX_WR12] - wstrd wR13, [r1, #MMX_WR13] - wstrd wR14, [r1, #MMX_WR14] - wstrd wR15, [r1, #MMX_WR15] + wstrd wR0, r1, MMX_WR0 + wstrd wR1, r1, MMX_WR1 + wstrd wR2, r1, MMX_WR2 + wstrd wR3, r1, MMX_WR3 + wstrd wR4, r1, MMX_WR4 + wstrd wR5, r1, MMX_WR5 + wstrd wR6, r1, MMX_WR6 + wstrd wR7, r1, MMX_WR7 + wstrd wR8, r1, MMX_WR8 + wstrd wR9, r1, MMX_WR9 + wstrd wR10, r1, MMX_WR10 + wstrd wR11, r1, MMX_WR11 + wstrd wR12, r1, MMX_WR12 + wstrd wR13, r1, MMX_WR13 + wstrd wR14, r1, MMX_WR14 + wstrd wR15, r1, MMX_WR15 2: teq r0, #0 @ anything to load? reteq lr @ if not, return @@ -147,30 +148,30 @@ concan_dump: concan_load: @ Load wRn - wldrd wR0, [r0, #MMX_WR0] - wldrd wR1, [r0, #MMX_WR1] - wldrd wR2, [r0, #MMX_WR2] - wldrd wR3, [r0, #MMX_WR3] - wldrd wR4, [r0, #MMX_WR4] - wldrd wR5, [r0, #MMX_WR5] - wldrd wR6, [r0, #MMX_WR6] - wldrd wR7, [r0, #MMX_WR7] - wldrd wR8, [r0, #MMX_WR8] - wldrd wR9, [r0, #MMX_WR9] - wldrd wR10, [r0, #MMX_WR10] - wldrd wR11, [r0, #MMX_WR11] - wldrd wR12, [r0, #MMX_WR12] - wldrd wR13, [r0, #MMX_WR13] - wldrd wR14, [r0, #MMX_WR14] - wldrd wR15, [r0, #MMX_WR15] + wldrd wR0, r0, MMX_WR0 + wldrd wR1, r0, MMX_WR1 + wldrd wR2, r0, MMX_WR2 + wldrd wR3, r0, MMX_WR3 + wldrd wR4, r0, MMX_WR4 + wldrd wR5, r0, MMX_WR5 + wldrd wR6, r0, MMX_WR6 + wldrd wR7, r0, MMX_WR7 + wldrd wR8, r0, MMX_WR8 + wldrd wR9, r0, MMX_WR9 + wldrd wR10, r0, MMX_WR10 + wldrd wR11, r0, MMX_WR11 + wldrd wR12, r0, MMX_WR12 + wldrd wR13, r0, MMX_WR13 + wldrd wR14, r0, MMX_WR14 + wldrd wR15, r0, MMX_WR15 @ Load wCx - wldrw wCSSF, [r0, #MMX_WCSSF] - wldrw wCASF, [r0, #MMX_WCASF] - wldrw wCGR0, [r0, #MMX_WCGR0] - wldrw wCGR1, [r0, #MMX_WCGR1] - wldrw wCGR2, [r0, #MMX_WCGR2] - wldrw wCGR3, [r0, #MMX_WCGR3] + wldrw wCSSF, r0, MMX_WCSSF + wldrw wCASF, r0, MMX_WCASF + wldrw wCGR0, r0, MMX_WCGR0 + wldrw wCGR1, r0, MMX_WCGR1 + wldrw wCGR2, r0, MMX_WCGR2 + wldrw wCGR3, r0, MMX_WCGR3 @ clear CUP/MUP (only if r1 != 0) teq r1, #0 -- 2.29.2.299.gdc1121823c-goog