android_kernel_oneplus_msm8998/lib/raid6
Nathan Chancellor b67ef52116 ARM: 8833/1: Ensure that NEON code always compiles with Clang
[ Upstream commit de9c0d49d85dc563549972edc5589d195cd5e859 ]

While building arm32 allyesconfig, I ran into the following errors:

  arch/arm/lib/xor-neon.c:17:2: error: You should compile this file with
  '-mfloat-abi=softfp -mfpu=neon'

  In file included from lib/raid6/neon1.c:27:
  /home/nathan/cbl/prebuilt/lib/clang/8.0.0/include/arm_neon.h:28:2:
  error: "NEON support not enabled"

Building V=1 showed NEON_FLAGS getting passed along to Clang but
__ARM_NEON__ was not getting defined. Ultimately, it boils down to Clang
only defining __ARM_NEON__ when targeting armv7, rather than armv6k,
which is the '-march' value for allyesconfig.

>From lib/Basic/Targets/ARM.cpp in the Clang source:

  // This only gets set when Neon instructions are actually available, unlike
  // the VFP define, hence the soft float and arch check. This is subtly
  // different from gcc, we follow the intent which was that it should be set
  // when Neon instructions are actually available.
  if ((FPU & NeonFPU) && !SoftFloat && ArchVersion >= 7) {
    Builder.defineMacro("__ARM_NEON", "1");
    Builder.defineMacro("__ARM_NEON__");
    // current AArch32 NEON implementations do not support double-precision
    // floating-point even when it is present in VFP.
    Builder.defineMacro("__ARM_NEON_FP",
                        "0x" + Twine::utohexstr(HW_FP & ~HW_FP_DP));
  }

Ard Biesheuvel recommended explicitly adding '-march=armv7-a' at the
beginning of the NEON_FLAGS definitions so that __ARM_NEON__ always gets
definined by Clang. This doesn't functionally change anything because
that code will only run where NEON is supported, which is implicitly
armv7.

Link: https://github.com/ClangBuiltLinux/linux/issues/287

Suggested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Acked-by: Nicolas Pitre <nico@linaro.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-04-27 09:33:51 +02:00
..
test lib/raid6: Fix arm64 test build 2018-11-27 16:08:01 +01:00
.gitignore lib/raid6: add ARM-NEON accelerated syndrome calculation 2013-07-08 22:09:18 +01:00
algos.c md/raid6 algorithms: delta syndrome functions 2015-04-22 08:00:41 +10:00
altivec.uc md/raid6 algorithms: delta syndrome functions 2015-04-22 08:00:41 +10:00
avx2.c md/raid6 algorithms: delta syndrome functions 2015-04-22 08:00:41 +10:00
int.uc md/raid6 algorithms: xor_syndrome() for generic int 2015-04-22 08:00:42 +10:00
Makefile ARM: 8833/1: Ensure that NEON code always compiles with Clang 2019-04-27 09:33:51 +02:00
mktables.c lib/raid6: Add SSSE3 optimized recovery functions 2012-05-22 13:54:18 +10:00
mmx.c md/raid6 algorithms: delta syndrome functions 2015-04-22 08:00:41 +10:00
neon.c md/raid6: delta syndrome for ARM NEON 2015-08-31 19:29:05 +02:00
neon.uc md/raid6: delta syndrome for ARM NEON 2015-08-31 19:29:05 +02:00
recov.c lib/raid6: fix sparse warnings in recovery functions 2012-05-28 14:10:22 +10:00
recov_avx2.c x86/raid6: correctly check for assembler capabilities 2015-02-04 08:35:51 +11:00
recov_ssse3.c x86/raid6: correctly check for assembler capabilities 2015-02-04 08:35:51 +11:00
sse1.c md/raid6 algorithms: delta syndrome functions 2015-04-22 08:00:41 +10:00
sse2.c md/raid6 algorithms: xor_syndrome() for SSE2 2015-04-22 08:00:42 +10:00
tilegx.uc md/raid6 algorithms: delta syndrome functions 2015-04-22 08:00:41 +10:00
unroll.awk Merge branch 'async' of macbook:git/btrfs-unstable 2010-08-09 10:36:44 +01:00
x86.h x86/fpu: Rename i387.h to fpu/api.h 2015-05-19 15:47:30 +02:00