Hi all,
Currently on AArch32, invoking with -march=armv8.2-a+dotprod -mfpu=neon
incorrectly enables armv7 dotproduct. This patch restricts dotproduct to armv8
to correct the issue.
When using a float ABI different from that of the host platform, including
/usr/include/gnu/stubs.h errors due to a non-existent stubs-soft.h file, so
an inclusion of a standard header file is required to compile successfully and
find the correct float ABI to select in
check_effective_target_arm_v8_2a_dotprod_neon_ok_nocache.
Bootstrapped and regression tested on arm-none-linux-gnueabihf with no
regressions.
OK for trunk?
gcc/ChangeLog:
2018-11-23 Sam Tebbs<[email protected]>
* config/arm/arm.h (TARGET_DOTPROD): Add TARGET_VFP5 constraint.
gcc/testsuite/ChangeLog:
2018-11-23 Sam Tebbs<[email protected]>
* gcc.target/arm/neon-dotprod-restriction.c: New file.
* lib/target-supports.exp
(check_effective_target_arm_v8_2a_dotprod_neon_ok_nocache):
Include stdint.h.
diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
index 8472312487b50d93edf47cd31660efd6bc043387..ab63fc5797a12c172ed77437b65388dd115146f3 100644
--- a/gcc/config/arm/arm.h
+++ b/gcc/config/arm/arm.h
@@ -214,7 +214,7 @@ extern tree arm_fp16_type_node;
#define TARGET_NEON_RDMA (TARGET_NEON && arm_arch8_1)
/* Supports the Dot Product AdvSIMD extensions. */
-#define TARGET_DOTPROD (TARGET_NEON \
+#define TARGET_DOTPROD (TARGET_NEON && TARGET_VFP5 \
&& bitmap_bit_p (arm_active_target.isa, \
isa_bit_dotprod) \
&& arm_arch8_2)
diff --git a/gcc/testsuite/gcc.target/arm/neon-dotprod-restriction.c b/gcc/testsuite/gcc.target/arm/neon-dotprod-restriction.c
new file mode 100644
index 0000000000000000000000000000000000000000..41a8992ff2a08af8ebd53f8f1ed5dcf67d86ddd3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/neon-dotprod-restriction.c
@@ -0,0 +1,6 @@
+/* { dg-do "compile" } */
+/* { dg-options "-march=armv8.2-a+dotprod -mfpu=neon" } */
+
+#ifdef __ARM_FEATURE_DOTPROD
+#error Dot product is enabled when it should not be
+#endif
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index c2a944738ccf8e1efc5249d0420ddeac1934cb31..06831627462435c10a1d7040bbeeba31037db949 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -4400,6 +4400,7 @@ proc check_effective_target_arm_v8_2a_dotprod_neon_ok_nocache { } {
foreach flags {"" "-mfloat-abi=softfp -mfpu=neon-fp-armv8" "-mfloat-abi=hard -mfpu=neon-fp-armv8"} {
if { [check_no_compiler_messages_nocache \
arm_v8_2a_dotprod_neon_ok object {
+ #include <stdint.h>
#if !defined (__ARM_FEATURE_DOTPROD)
#error "__ARM_FEATURE_DOTPROD not defined"
#endif