This patch makes use of the new ability to unset the CPU or architecture flags on the command line to enable several more tests on Arm. It doesn't cover every case and it does enable some tests that now fail for different reasons when the tests are no-longer skipped; these were failing anyway for other testsuite configurations, so it's still an overall improvement.
There's some restructuring required to fully implement this change: we could previously treat Xscale as an architecture, even though the option set -mcpu=, we now need to handle this correctly so that we unset the architecture rather than the CPU. To do this I've added a new table for these variants and renamed the template functions to use 'cpu' rather than 'arch'. This entailed updating the two XScale related tests accordingly. gcc/testsuite/ChangeLog: * lib/target-supports.exp: Move xscale to new generator table. (check_effective_target_arm_arch_FUNC_ok): Add -mcpu=unset to the list of flags. (add_options_for_arm_arch_FUNC): Likewise. (check_effective_target_arm_cpu_FUNC_ok): New function. (add_options_for_arm_cpu_FUNC): Likewise. (check_effective_target_arm_cpu_FUNC_link): Likewise. (check_effective_target_arm_cpu_FUNC_multilib): Likewise. * gcc.target/arm/g2.c: Update dg directives. * gcc.target/arm/scd42-2.c: Likewise. --- gcc/testsuite/gcc.target/arm/g2.c | 4 +- gcc/testsuite/gcc.target/arm/scd42-2.c | 4 +- gcc/testsuite/lib/target-supports.exp | 59 ++++++++++++++++++++++++-- 3 files changed, 60 insertions(+), 7 deletions(-) diff --git a/gcc/testsuite/gcc.target/arm/g2.c b/gcc/testsuite/gcc.target/arm/g2.c index 04334c97713..7e43a907a4c 100644 --- a/gcc/testsuite/gcc.target/arm/g2.c +++ b/gcc/testsuite/gcc.target/arm/g2.c @@ -1,8 +1,8 @@ /* Verify that hardware multiply is preferred on XScale. */ /* { dg-do compile } */ /* { dg-options "-O2" } */ -/* { dg-require-effective-target arm_arch_xscale_arm_ok } */ -/* { dg-add-options arm_arch_xscale_arm } */ +/* { dg-require-effective-target arm_cpu_xscale_arm_ok } */ +/* { dg-add-options arm_cpu_xscale_arm } */ /* Brett Gaines' test case. */ diff --git a/gcc/testsuite/gcc.target/arm/scd42-2.c b/gcc/testsuite/gcc.target/arm/scd42-2.c index cd416885a80..a263c1fbff9 100644 --- a/gcc/testsuite/gcc.target/arm/scd42-2.c +++ b/gcc/testsuite/gcc.target/arm/scd42-2.c @@ -1,8 +1,8 @@ /* Verify that mov is preferred on XScale for loading a 2 byte constant. */ /* { dg-do compile } */ -/* { dg-require-effective-target arm_arch_xscale_arm_ok } */ +/* { dg-require-effective-target arm_cpu_xscale_arm_ok } */ /* { dg-options "-O" } */ -/* { dg-add-options arm_arch_xscale_arm } */ +/* { dg-add-options arm_cpu_xscale_arm } */ unsigned load2(void) __attribute__ ((naked)); unsigned load2(void) diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index cb9971d5398..c4d2c33cf62 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -5679,6 +5679,9 @@ proc check_effective_target_arm_fp16_hw { } { # Usage: /* { dg-require-effective-target arm_arch_v5_ok } */ # /* { dg-add-options arm_arch_v5t } */ # /* { dg-require-effective-target arm_arch_v5t_multilib } */ + +# This table should only be used to set -march= (and associated +# flags). See below for setting -mcpu foreach { armfunc armflag armdefs } { v4 "-march=armv4 -marm" __ARM_ARCH_4__ v4t "-march=armv4t -mfloat-abi=softfp" __ARM_ARCH_4T__ @@ -5690,7 +5693,6 @@ foreach { armfunc armflag armdefs } { v5te "-march=armv5te+fp -mfloat-abi=softfp" __ARM_ARCH_5TE__ v5te_arm "-march=armv5te+fp -marm" "__ARM_ARCH_5TE__ && !__thumb__" v5te_thumb "-march=armv5te+fp -mthumb -mfloat-abi=softfp" "__ARM_ARCH_5TE__ && __thumb__" - xscale_arm "-mcpu=xscale -mfloat-abi=soft -marm" "__XSCALE__ && !__thumb__" v6 "-march=armv6+fp -mfloat-abi=softfp" __ARM_ARCH_6__ v6_arm "-march=armv6+fp -marm" "__ARM_ARCH_6__ && !__thumb__" v6_thumb "-march=armv6+fp -mthumb -mfloat-abi=softfp" "__ARM_ARCH_6__ && __thumb__" @@ -5735,11 +5737,11 @@ foreach { armfunc armflag armdefs } { { return 0; } - } "FLAG" ] + } "-mcpu=unset FLAG" ] } proc add_options_for_arm_arch_FUNC { flags } { - return "$flags FLAG" + return "$flags -mcpu=unset FLAG" } proc check_effective_target_arm_arch_FUNC_link { } { @@ -5762,6 +5764,57 @@ foreach { armfunc armflag armdefs } { }] } +# Creates a series of routines that return 1 if the given CPU +# can be selected and a routine to give the flags to select that CPU +# Note: Extra flags may be added to disable options from newer compilers +# (Thumb in particular - but others may be added in the future). +# Usage: /* { dg-require-effective-target arm_cpu_xscale_ok } */ +# /* { dg-add-options arm_cpu_xscale } */ +# /* { dg-require-effective-target arm_xscale_multilib } */ + +# This table should only be used to set -mcpu= (and associated +# flags). See above for setting -march=. +foreach { armfunc armflag armdefs } { + xscale_arm "-mcpu=xscale -mfloat-abi=soft -marm" "__XSCALE__ && !__thumb__" + } { + eval [string map [list FUNC $armfunc FLAG $armflag DEFS $armdefs ] { + proc check_effective_target_arm_cpu_FUNC_ok { } { + return [check_no_compiler_messages arm_cpu_FUNC_ok assembly { + #if !(DEFS) + #error !(DEFS) + #endif + int + main (void) + { + return 0; + } + } "-march=unset FLAG" ] + } + + proc add_options_for_arm_cpu_FUNC { flags } { + return "$flags -march=unset FLAG" + } + + proc check_effective_target_arm_cpu_FUNC_link { } { + return [check_no_compiler_messages arm_cpu_FUNC_link executable { + #include <stdint.h> + int dummy; + int main (void) { return 0; } + } [add_options_for_arm_cpu_FUNC ""]] + } + + proc check_effective_target_arm_cpu_FUNC_multilib { } { + return [check_runtime arm_cpu_FUNC_multilib { + int + main (void) + { + return 0; + } + } [add_options_for_arm_cpu_FUNC ""]] + } + }] +} + # Return 1 if GCC was configured with --with-mode= proc check_effective_target_default_mode { } { -- 2.34.1