From: Christophe Lyon Date: Tue, 21 Apr 2020 07:31:59 +0000 (+0000) Subject: testsuite/arm: Add arm_dsp_ok effective target and use it in arm/acle/dsp_arith.c X-Git-Tag: basepoints/gcc-12~459 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3c3c0042736846c469cddd70d56eca7239dbad01;p=thirdparty%2Fgcc.git testsuite/arm: Add arm_dsp_ok effective target and use it in arm/acle/dsp_arith.c 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 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. --- diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index 1fa36566453b..2bc362be4495 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -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. diff --git a/gcc/testsuite/gcc.target/arm/acle/dsp_arith.c b/gcc/testsuite/gcc.target/arm/acle/dsp_arith.c index 9ebd55a12879..7bf458e8f8dd 100644 --- a/gcc/testsuite/gcc.target/arm/acle/dsp_arith.c +++ b/gcc/testsuite/gcc.target/arm/acle/dsp_arith.c @@ -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 diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 1af7619273fe..733b6c845185 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -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 + 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).