Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp900932pxb; Tue, 1 Feb 2022 12:46:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJwy4sitf8+0kiowcz3CVOXGmR/bpPbPQSugh+MhCmPTv0MhWZQkGWIB9rRAe2hrLyUjOgN5 X-Received: by 2002:a17:90b:3007:: with SMTP id hg7mr4428531pjb.78.1643748412605; Tue, 01 Feb 2022 12:46:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643748412; cv=none; d=google.com; s=arc-20160816; b=UMzBr5+Uo6H/PFXhBfZTqKMb30rINu3BeJ6AbggQ+jji3ikDJPo2T8dYDqJz2RBPkn jISFq2R5ysMmgF7OpMTIZu2OfRMB0V832dcRsCgKjodD2ji5OVJ2EiZKMLXzNYib1gDr A1fKX4KER4OtaV3fjhd1GbgTaPunrRp6trql4pSiaQCxPjBALQJ3FxJ0ZdpkMmcKO2Rf ZPhMiFCAz0hFjvMp+q8lzbTEMVgc82orfCHl0tsCzflpo9lV4HWyqM2F+x1vX27PSO4z ZIdhLEUOJF61p11JlS7vWpCdqS714xZKwbOb88hNKxYhvQt9cSSPiDSqj3JzwjTIbRru Ek/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=gyEQrK489u7hChy2E+c7sGCUR0+nczU4u5IQ7M/S6eI=; b=KHh/pxRF87IfN6Sb9HCfZhMu7GdhRAabtTFtIYVXq0eUrUpi7bY/rLFOkNT1p3MviH kS6A49/S1VRPMnG8EVgZ0d4J8r7r138AkMMoH63y7qRI3uJIsHT2uuh2seRYnaKLium3 HYfytVzj12jBMPOxR2AcpF+LWNJPqp2Rdi8RXikGV6fpTltlzc9DIZ1U+/GoY/At65oy L9S1czD+L2f2J4LRpXcpYrvvD7caREeoAGD3Zyl0kr2e0sN2+0TXF91K63x7aD8OHERE o0jrANiLcsaUuGqhnWGT1lYQbZydl940JH0y3chd8dupqJt7qpaSEBQiZByZzN75Z6MJ E/Sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=IeLNj0bc; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-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 d14si16083997pls.470.2022.02.01.12.46.40; Tue, 01 Feb 2022 12:46:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-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=20210112 header.b=IeLNj0bc; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-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 S239574AbiAaSQi (ORCPT + 99 others); Mon, 31 Jan 2022 13:16:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236914AbiAaSQi (ORCPT ); Mon, 31 Jan 2022 13:16:38 -0500 Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CEE5C061714 for ; Mon, 31 Jan 2022 10:16:38 -0800 (PST) Received: by mail-lj1-x236.google.com with SMTP id z20so20585442ljo.6 for ; Mon, 31 Jan 2022 10:16:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=gyEQrK489u7hChy2E+c7sGCUR0+nczU4u5IQ7M/S6eI=; b=IeLNj0bcyA05XSywkBjL/WClby7sJbn4LuVShqHglERWo7vx2pnu9yahaxWMYX+Ea+ mg91pJC+aCBulku1EXIUZzA2+Mt5z1daB5WuYdGyFTXavP3zchbwpt04h9Jspd5jkb/I Q1IcwHxjSH3dIamV0OSOa4uHZxlcPBDUSD0F4MMa1Ay+iXTuTzvyYt99YQjagOE8OEw7 Zt6daGwzAPE/xk/vvcKdEwtjixoTAy+UDP4CcFkSIdodQNUMC0TSJWwAfgaXzrQRdTXv zPKrjthznH1nY82Z5h8sxWJiiAk72taUfmP/GKfWoaHioaHgYjuOLZaFjci/uyzQmfAY +u4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=gyEQrK489u7hChy2E+c7sGCUR0+nczU4u5IQ7M/S6eI=; b=EVR+rYcQOQw34SngF++8GUyDRfn58f/Ly4ufw22x3uYsoXP3JCM4yM1b83FbASw6JG HlYvNn1ixpUcxSQm9Ne7bcAwdHIYfUFXSv6J8UsMiOr9EpLMWu9/0GrxaX3oRYumnIGJ HKKGTVUvb+vj265SlthdbABg4+KQu7FNyaDGqsV5XaUBsl/wxz0KeH/5w7uopY419u98 2GHtTJeqJayza5KLxjPB1mzIhMn04AlqOWAwsGF06WO3fCCvVr8L18/4/ye0hYgYFLxv QqdPqhuszOGDxInI2e1H9GwpAATq4ny0KAAM2wrioF1mHNkyNR+0UIvayHkXXxOY37+3 is6Q== X-Gm-Message-State: AOAM531xJAmCi+SdLtHZTPiCLdJbRzAGAMcfarF+gH3cHYNf2uJr5u34 aDI7F4Ztwl6252s4z9mB3I4s2EllGSH1rvKK12w5sQ== X-Received: by 2002:a2e:b6d0:: with SMTP id m16mr6852861ljo.128.1643652996400; Mon, 31 Jan 2022 10:16:36 -0800 (PST) MIME-Version: 1.0 References: <20220129224529.76887-1-ardb@kernel.org> <20220129224529.76887-3-ardb@kernel.org> In-Reply-To: <20220129224529.76887-3-ardb@kernel.org> From: Nick Desaulniers Date: Mon, 31 Jan 2022 10:16:24 -0800 Message-ID: Subject: Re: [PATCH v2 2/2] crypto: arm/xor - make vectorized C code Clang-friendly To: Ard Biesheuvel Cc: linux-crypto@vger.kernel.org, herbert@gondor.apana.org.au, Nathan Chancellor Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Sat, Jan 29, 2022 at 2:45 PM Ard Biesheuvel wrote: > > The ARM version of the accelerated XOR routines are simply the 8-way C > routines passed through the auto-vectorizer with SIMD codegen enabled. > This used to require GCC version 4.6 at least, but given that 5.1 is now > the baseline, this check is no longer necessary, and actually > misidentifies Clang as GCC < 4.6 as Clang defines the GCC major/minor as > well, but makes no attempt at doing this in a way that conveys feature > parity with a certain version of GCC (which would not be a great idea in > the first place). > > So let's drop the version check, and make the auto-vectorize pragma > (which is based on a GCC-specific command line option) GCC-only. Since > Clang performs SIMD auto-vectorization by default at -O2, no pragma is > necessary here. > > Tested-by: Nathan Chancellor > Signed-off-by: Ard Biesheuvel Thanks for the patch! Reviewed-by: Nick Desaulniers Link: https://github.com/ClangBuiltLinux/linux/issues/496 Link: https://github.com/ClangBuiltLinux/linux/issues/503 > --- > arch/arm/lib/xor-neon.c | 12 +++--------- > 1 file changed, 3 insertions(+), 9 deletions(-) > > diff --git a/arch/arm/lib/xor-neon.c b/arch/arm/lib/xor-neon.c > index b99dd8e1c93f..522510baed49 100644 > --- a/arch/arm/lib/xor-neon.c > +++ b/arch/arm/lib/xor-neon.c > @@ -17,17 +17,11 @@ MODULE_LICENSE("GPL"); > /* > * Pull in the reference implementations while instructing GCC (through > * -ftree-vectorize) to attempt to exploit implicit parallelism and emit > - * NEON instructions. > + * NEON instructions. Clang does this by default at O2 so no pragma is > + * needed. > */ > -#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) > +#ifdef CONFIG_CC_IS_GCC > #pragma GCC optimize "tree-vectorize" > -#else > -/* > - * While older versions of GCC do not generate incorrect code, they fail to > - * recognize the parallel nature of these functions, and emit plain ARM code, > - * which is known to be slower than the optimized ARM code in asm-arm/xor.h. > - */ > -#warning This code requires at least version 4.6 of GCC > #endif > > #pragma GCC diagnostic ignored "-Wunused-variable" > -- > 2.30.2 > -- Thanks, ~Nick Desaulniers