The test checks that we don't accidentally vectorize when fp16 is NOT
enabled, so the test would fail when using
e.g. -march=armv8.1-m.main+mve.fp.
Introduce arm_mve_fp effective-target, similar to arm_mve, but check
if MVE floating-point is supported.
Skip the test in that case.
Tested on:
-mthumb/-march=armv8.1-m.main+mve.fp+fp.dp/-mtune=cortex-m55/-mfloat-abi=hard/-mfpu=auto
gcc/ChangeLog:
* doc/sourcebuild.texi: Document new arm_mve_fp effective-target.
gcc/testsuite/ChangeLog:
* lib/target-supports.exp: Add arm_mve_fp effective-target.
* gcc.target/arm/vect-half-floats.c: Add dg-skip-if for
arm_mve_fp.
---
gcc/doc/sourcebuild.texi | 5 +++++
gcc/testsuite/gcc.target/arm/vect-half-floats.c | 1 +
gcc/testsuite/lib/target-supports.exp | 16 ++++++++++++++++
3 files changed, 22 insertions(+)
diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index 3aa9fcbb577..9302259960a 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -2360,6 +2360,11 @@ ARM target supports the @code{-mfloat-abi=hard} option.
@anchor{arm_mve}
ARM target supports generating MVE instructions.
+@item arm_mve_fp
+@anchor{arm_mve_fp}
+ARM target supports generating MVE instructions with floating-point
+support.
+
@item arm_v8_1_lob_ok
@anchor{arm_v8_1_lob_ok}
ARM Target supports executing the Armv8.1-M Mainline Low Overhead Loop
diff --git a/gcc/testsuite/gcc.target/arm/vect-half-floats.c
b/gcc/testsuite/gcc.target/arm/vect-half-floats.c
index 49ca2e9b083..dc14688e9c1 100644
--- a/gcc/testsuite/gcc.target/arm/vect-half-floats.c
+++ b/gcc/testsuite/gcc.target/arm/vect-half-floats.c
@@ -1,4 +1,5 @@
/* { dg-do compile } */
+/* { dg-skip-if "mve.fp supports fp16 vectorization" { arm_mve_fp } } */
/* { dg-options "-Ofast -ftree-vectorize -fdump-tree-vect-all -std=c11" } */
/* { dg-require-effective-target float16 } */
/* { dg-require-effective-target arm_fp16_ok } */
diff --git a/gcc/testsuite/lib/target-supports.exp
b/gcc/testsuite/lib/target-supports.exp
index ae04b6a8daa..803376006ae 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -7019,6 +7019,22 @@ proc check_effective_target_arm_mve { } {
}]
}
+# Return 1 if this is an ARM target supporting MVE with floating-point
+# instructions.
+proc check_effective_target_arm_mve_fp { } {
+ if { ![istarget arm*-*-*] } {
+ return 0
+ }
+ return [check_no_compiler_messages arm_mve_fp assembly {
+ #if !defined (__ARM_FEATURE_MVE)
+ #error "__ARM_FEATURE_MVE not defined"
+ #endif
+ #if !(__ARM_FEATURE_MVE & 2)
+ #error "__ARM_FEATURE_MVE for floating point not defined"
+ #endif
+ }]
+}
+
# Return 1 if the target supports ARMv8.1-M MVE with floating point
# instructions, 0 otherwise. The test is valid for ARM.
# Record the command line options needed.
--
2.43.0