]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
testsuite/arm: Add arm_dsp_ok effective target and use it in arm/acle/dsp_arith.c
authorChristophe Lyon <christophe.lyon@linaro.org>
Tue, 21 Apr 2020 07:31:59 +0000 (07:31 +0000)
committerChristophe Lyon <christophe.lyon@linaro.org>
Tue, 23 Mar 2021 15:11:52 +0000 (15:11 +0000)
gcc.target/arm/acle/dsp_arith.c uses DSP intrinsics, which arm_acle.h
defines only with __ARM_FEATURE_DSP, so make the test check for that
property rather than arm_qbit_ok.

However, the existing arm_dsp effective target only checks if DSP
features are supported with the current multilib rather than trying
-march and -mfloat-abi options. Thus we introduce a similar effective
target, arm_dsp_ok and associated dg-add-options.

This makes dsp_arith.c unsupported rather than failed when no option
combination is suitable, for instance when running the tests with
-mcpu=cortex-m3.

2021-03-19  Christophe Lyon  <christophe.lyon@linaro.org>

gcc/
* doc/sourcebuild.texi (arm_dsp_ok, arm_dsp): Document.

gcc/testsuite/
* lib/target-supports.exp
(check_effective_target_arm_dsp_ok_nocache)
(check_effective_target_arm_dsp_ok, add_options_for_arm_dsp): New.
* gcc.target/arm/acle/dsp_arith.c: Use arm_dsp_ok effective target
and add arm_dsp options.

gcc/doc/sourcebuild.texi
gcc/testsuite/gcc.target/arm/acle/dsp_arith.c
gcc/testsuite/lib/target-supports.exp

index 1fa36566453b6a3fdde610f1336996c970d0adfe..2bc362be4495d6cfe1ce0b25e3b8b76bcb4641b7 100644 (file)
@@ -2044,6 +2044,12 @@ ARM Target supports options suitable for accessing the Q-bit manipulation
 intrinsics from @code{arm_acle.h}.
 Some multilibs may be incompatible with these options.
 
+@item arm_dsp_ok
+@anchor{arm_dsp_ok}
+ARM Target supports options suitable for accessing the DSP intrinsics
+from @code{arm_acle.h}.
+Some multilibs may be incompatible with these options.
+
 @item arm_softfp_ok
 @anchor{arm_softfp_ok}
 ARM target supports the @code{-mfloat-abi=softfp} option.
@@ -2778,6 +2784,11 @@ Add options to enable generation of the @code{VFMAL} and @code{VFMSL}
 instructions, if this is supported by the target; see the
 @ref{arm_fp16fml_neon_ok} effective target keyword.
 
+@item arm_dsp
+Add options for ARM DSP intrinsics support, if this is supported by
+the target; see the @ref{arm_dsp_ok,,arm_dsp_ok effective target
+keyword}.
+
 @item bind_pic_locally
 Add the target-specific flags needed to enable functions to bind
 locally when using pic/PIC passes in the testsuite.
index 9ebd55a12879a198b76f4645912187a4d16c9363..7bf458e8f8ddb04c83ae95ff8b7508dccd2427d0 100644 (file)
@@ -1,6 +1,6 @@
 /* { dg-do compile } */
-/* { dg-require-effective-target arm_qbit_ok } */
-/* { dg-add-options arm_qbit  } */
+/* { dg-require-effective-target arm_dsp_ok } */
+/* { dg-add-options arm_dsp } */
 
 #include <arm_acle.h>
 
index 1af7619273fefde9673ec99ab6e943863d3579ca..733b6c84518517fca0a8c88e0e7dbe46e59f07e2 100644 (file)
@@ -4200,6 +4200,46 @@ proc add_options_for_arm_qbit { flags } {
     return "$flags $et_arm_qbit_flags"
 }
 
+# Return 1 if this is an ARM target supporting the DSP intrinsics from
+# arm_acle.h.  Some multilibs may be incompatible with these options.
+# Also set et_arm_dsp_flags to the best options to add.
+# arm_acle.h includes stdint.h which can cause trouble with incompatible
+# -mfloat-abi= options.
+# check_effective_target_arm_dsp also exists, which checks the current
+# multilib, without trying other options.
+
+proc check_effective_target_arm_dsp_ok_nocache { } {
+    global et_arm_dsp_flags
+    set et_arm_dsp_flags ""
+    foreach flags {"" "-march=armv5te" "-march=armv5te -mfloat-abi=softfp" "-march=armv5te -mfloat-abi=hard"} {
+      if { [check_no_compiler_messages_nocache et_arm_dsp_ok object {
+       #include <arm_acle.h>
+       int dummy;
+       #ifndef __ARM_FEATURE_DSP
+       #error not DSP
+       #endif
+      } "$flags"] } {
+       set et_arm_dsp_flags $flags
+       return 1
+      }
+    }
+
+  return 0
+}
+
+proc check_effective_target_arm_dsp_ok { } {
+    return [check_cached_effective_target et_arm_dsp_flags \
+               check_effective_target_arm_dsp_ok_nocache]
+}
+
+proc add_options_for_arm_dsp { flags } {
+    if { ! [check_effective_target_arm_dsp_ok] } {
+       return "$flags"
+    }
+    global et_arm_dsp_flags
+    return "$flags $et_arm_dsp_flags"
+}
+
 # Return 1 if this is an ARM target supporting -mfpu=neon without any
 # -mfloat-abi= option.  Useful in tests where add_options is not
 # supported (such as lto tests).