From patchwork Tue Feb 26 04:03:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 159188 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp2774406jad; Mon, 25 Feb 2019 20:03:53 -0800 (PST) X-Google-Smtp-Source: AHgI3IYT0wTJ89NvxIzgboPnTeD2Ie8eXwVW7k64TLMVk9ewPCJfOrinlW/2/iE33S1gqc1clyM5 X-Received: by 2002:a17:902:6804:: with SMTP id h4mr23937682plk.115.1551153833663; Mon, 25 Feb 2019 20:03:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551153833; cv=none; d=google.com; s=arc-20160816; b=mGnB8PI5igLS2shPUv3m2C1WV5TG3A2zALUPqGCJY8XkwG0ECg0yQisd6C7w0iUZf1 GPMeUkBCQpxr6M1guRddVgopyIL1aVVeG7Wa+HPmXz0aW3v0HenncltPmj7JwrsxbW/G UGKztKENqsXlyRfsh+ixtBcOTe90GW8n3oE01MOlbxaac7PAY9OwpKg6Uvd+Q39xjEzl WY2JFxErjbV3PNzOK4QyHfqz5mHouxvKFMkEAsb5g0a7Sz4LEABqeV6uN/V9YLGZe4s0 M9YjNqkeioYoTOeK10T7h1hwIo2BC7yF4XBFOK/JxtQiCE1U5VKpvir91eJeuC8k5tAD /QfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:mime-version :message-id:date:dkim-signature; bh=x10LJfG0C5xfpCC8UWS+z2MD3Rfq8aeRGOdkTRz2fqU=; b=jtpn/BDu+WDXfhe7QQ/99xO6zc/JFhDEKoQWkCybK4K6xaS1rlKK+I7XOzzNEvE/oe OwGtV0FNvnMpsWHolXmbr9XAwnhTD/pRBQXBSmNQoyvyJx59ZsMpflUlTsZ5cxof2WUA jjx/ozbZVWQxsvj6X4IiGfHKkdQSkV1F4DNmpx6QwikMXdIVSR3N9KYaNJVfuhTDWf7O gYOqOUK6JBipbGv69cWEXIge3UCTyfiL5+Qj42etuDH7m/OB4s2EdVj7erFFQB1QxDqo qvyPms2Eew3PZtbrIen+h894w3+Hcd698YKB5vDe5SiHeZtl1f1lrIoovAb6JCvZRl2u ZLtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="OlYw8H/B"; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g132si11717564pfc.240.2019.02.25.20.03.53; Mon, 25 Feb 2019 20:03:53 -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=@google.com header.s=20161025 header.b="OlYw8H/B"; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726185AbfBZEDv (ORCPT + 31 others); Mon, 25 Feb 2019 23:03:51 -0500 Received: from mail-pg1-f201.google.com ([209.85.215.201]:33633 "EHLO mail-pg1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725877AbfBZEDv (ORCPT ); Mon, 25 Feb 2019 23:03:51 -0500 Received: by mail-pg1-f201.google.com with SMTP id y1so8679268pgo.0 for ; Mon, 25 Feb 2019 20:03:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=x10LJfG0C5xfpCC8UWS+z2MD3Rfq8aeRGOdkTRz2fqU=; b=OlYw8H/BR6j2EDgWfSe/Hr1VsX55ESIbzvAfgkeXRMiw4Wg51BqQ10SM1vYHBr19xZ Qf8Fl1Kyq/bXhXCcPUcImdALPwyXfj7yodQrTI1+d3/NzTGyNjyYUK35A7z3oLcRFJjT RS0Omv0bHrpRPC7EcApYYxQwKIE5stEZl1N53eLA7jkjWpT1B0EcitWiOokrryv55KUD XsjxNHed9Tu/bgZaQAC5KLW1zfQZNf+9PRivel+kVddOpn7K992OTpx7rSXvEPWFx1ev CkVxvntjcfUhLlSwDhho5zHb11gqqloRBZdCB3N2lvp3HkfJI61BM7NcPpoisC2A59RM ZrBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=x10LJfG0C5xfpCC8UWS+z2MD3Rfq8aeRGOdkTRz2fqU=; b=LCdOynvTJ8veezppjMasYbx4bTMzoUGBYYK7vmyGOqTiJW+X9z04SnZaiHqwyMAlwV 3kutVDg5MVP+C6HUkZkbe4i/ucswYZOy2uKzZi3jhS1/dD/NRCRtg3kg8zd7zzCDlkQY fvvCDD7famH5YvgtvKs6ghb21Qk4PWqUsB+drfctKxNZq5Er7rmx+UXRg57+9Pzl94BX fbj/ZQcg5nvYyk/8FS/C0gDokHcwaN3WqY/HWrYUAW6A8lUqvFvY7lDuwPvN0gk4EkS8 iIrcAHM8wC0u/p0tmt57H1n1SURcdcxDsnMPldB8Zf+q01iBn95dPKcPokm7etO6imGv gIJg== X-Gm-Message-State: AHQUAuaD4pmqH53XiHIwq6QnL+TMOediMTbIOgkTiDiXNaDqtquMb+ir 20KB2gih8NydlK8FQPWXLB5vsSzCsMDuPlYQIqg= X-Received: by 2002:a63:d151:: with SMTP id c17mr1594737pgj.87.1551153829952; Mon, 25 Feb 2019 20:03:49 -0800 (PST) Date: Mon, 25 Feb 2019 20:03:42 -0800 Message-Id: <20190226040345.202047-1-ndesaulniers@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.21.0.rc2.261.ga7da99ff1b-goog Subject: [PATCH] lib/raid6: use vdupq_n_u8 to avoid endianness warnings From: ndesaulniers@google.com To: catalin.marinas@arm.com, will.deacon@arm.com Cc: ard.biesheuvel@linaro.org, arnd@arndb.de, broonie@kernel.org, linux@armlinux.org.uk, linux-arm-kernel@lists.infradead.org, Nick Desaulniers , Nathan Chancellor , linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Clang warns: vector initializers are not compatible with NEON intrinsics in big endian mode [-Wnonportable-vector-initialization] While this is usually the case, it's not an issue for this case since we're initializing the uint8x16_t (16x uint8_t's) with the same value. Instead, use vdupq_n_u8 which both compilers lower into a single movi instruction: https://godbolt.org/z/vBrgzt This avoids the static storage for a constant value. Link: https://github.com/ClangBuiltLinux/linux/issues/214 Suggested-by: Nathan Chancellor Signed-off-by: Nick Desaulniers --- lib/raid6/neon.uc | 5 ++--- lib/raid6/recov_neon_inner.c | 7 ++----- 2 files changed, 4 insertions(+), 8 deletions(-) -- 2.21.0.rc2.261.ga7da99ff1b-goog Reviewed-by: Ard Biesheuvel diff --git a/lib/raid6/neon.uc b/lib/raid6/neon.uc index d5242f544551..b7c68030da4f 100644 --- a/lib/raid6/neon.uc +++ b/lib/raid6/neon.uc @@ -28,7 +28,6 @@ typedef uint8x16_t unative_t; -#define NBYTES(x) ((unative_t){x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x}) #define NSIZE sizeof(unative_t) /* @@ -61,7 +60,7 @@ void raid6_neon$#_gen_syndrome_real(int disks, unsigned long bytes, void **ptrs) int d, z, z0; register unative_t wd$$, wq$$, wp$$, w1$$, w2$$; - const unative_t x1d = NBYTES(0x1d); + const unative_t x1d = vdupq_n_u8(0x1d); z0 = disks - 3; /* Highest data disk */ p = dptr[z0+1]; /* XOR parity */ @@ -92,7 +91,7 @@ void raid6_neon$#_xor_syndrome_real(int disks, int start, int stop, int d, z, z0; register unative_t wd$$, wq$$, wp$$, w1$$, w2$$; - const unative_t x1d = NBYTES(0x1d); + const unative_t x1d = vdupq_n_u8(0x1d); z0 = stop; /* P/Q right side optimization */ p = dptr[disks-2]; /* XOR parity */ diff --git a/lib/raid6/recov_neon_inner.c b/lib/raid6/recov_neon_inner.c index 8cd20c9f834a..7d00c31a6547 100644 --- a/lib/raid6/recov_neon_inner.c +++ b/lib/raid6/recov_neon_inner.c @@ -10,11 +10,6 @@ #include -static const uint8x16_t x0f = { - 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, - 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, -}; - #ifdef CONFIG_ARM /* * AArch32 does not provide this intrinsic natively because it does not @@ -41,6 +36,7 @@ void __raid6_2data_recov_neon(int bytes, uint8_t *p, uint8_t *q, uint8_t *dp, uint8x16_t pm1 = vld1q_u8(pbmul + 16); uint8x16_t qm0 = vld1q_u8(qmul); uint8x16_t qm1 = vld1q_u8(qmul + 16); + uint8x16_t x0f = vdupq_n_u8(0x0f); /* * while ( bytes-- ) { @@ -87,6 +83,7 @@ void __raid6_datap_recov_neon(int bytes, uint8_t *p, uint8_t *q, uint8_t *dq, { uint8x16_t qm0 = vld1q_u8(qmul); uint8x16_t qm1 = vld1q_u8(qmul + 16); + uint8x16_t x0f = vdupq_n_u8(0x0f); /* * while (bytes--) {