On Jun 19, 2025, Alexandre Oliva <ol...@adacore.com> wrote:

> Or maybe the requirements for this testcase should be stated as
> arm_arch_v7?  I'd have to add arm_arch_v7 to
> check_effective_target_arm_arch_FUNC_ok et al, if there aren't reasons
> why it's not there, but I'd be happy to do that, and use dg-add-options
> instead of an explicit -march=armv7, like pr117675.c, if that would be
> preferred.

It turned out that the regression report I got from linaro was related
https://linaro.atlassian.net/browse/GNU-1599

While testing a configuration with -mfloat-abi=hard, -marmv7 is rejected
because it doesn't have an FPU.

Requiring thumb2 wouldn't have avoided this failure, but requiring armv7
is a proper fix for both problems.

(sorry it me took so long; I'm still busy busy with other
fp2sp-elimination-disabled-during-lra problems affecting arm)


Without stating the architecture version required by the test, test
runs with options that are incompatible with the required
architecture version fail, e.g. -mfloat-abi=hard.

armv7 was not covered by the long list of arm variants in
target-supports.exp, so add it, and use it for the effective target
requirement and for the option.

Tested on arm-eabi, and also on arm-vx7r2 with gcc-14.  Ok to install?


for  gcc/testsuite/ChangeLog

        PR rtl-optimization/120424
        * lib/target-supports.exp (arm arches): Add arm_arch_v7.
        * g++.target/arm/pr120424.C: Require armv7 support.  Use
        dg-add-options arm_arch_v7 instead of explicit -march=armv7.
---
 gcc/testsuite/g++.target/arm/pr120424.C |    4 +++-
 gcc/testsuite/lib/target-supports.exp   |    1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/g++.target/arm/pr120424.C 
b/gcc/testsuite/g++.target/arm/pr120424.C
index 4d0e49013c04a..40295ac80da93 100644
--- a/gcc/testsuite/g++.target/arm/pr120424.C
+++ b/gcc/testsuite/g++.target/arm/pr120424.C
@@ -1,5 +1,7 @@
 /* { dg-do compile } */
-/* { dg-options "-march=armv7 -O2 -fstack-clash-protection 
-fnon-call-exceptions" } */
+/* { dg-require-effective-target arm_arch_v7_ok } */
+/* { dg-options "-O2 -fstack-clash-protection -fnon-call-exceptions" } */
+/* { dg-add-options arm_arch_v7 } */
 /* { dg-final { scan-assembler-not {#-8} } } */
 /* LRA register elimination gets confused when register spilling
    causes arm_frame_pointer_required to switch from false to true, and
diff --git a/gcc/testsuite/lib/target-supports.exp 
b/gcc/testsuite/lib/target-supports.exp
index dfffe3adfbdd0..858fa1787f19c 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -6073,6 +6073,7 @@ foreach { armfunc armflag armdefs } {
        v6z_arm "-march=armv6z+fp -marm" "__ARM_ARCH_6Z__ && !__thumb__"
        v6z_thumb "-march=armv6z+fp -mthumb -mfloat-abi=softfp" 
"__ARM_ARCH_6Z__ && __thumb__"
        v6m "-march=armv6-m -mthumb -mfloat-abi=soft" __ARM_ARCH_6M__
+       v7 "-march=armv7" __ARM_ARCH_7__
        v7a "-march=armv7-a+fp" __ARM_ARCH_7A__
        v7a_arm "-march=armv7-a+fp -marm" "__ARM_ARCH_7A__ && !__thumb__"
        v7a_fp_hard "-march=armv7-a+fp -mfpu=auto -mfloat-abi=hard" 
__ARM_ARCH_7A__


-- 
Alexandre Oliva, happy hacker            https://blog.lx.oliva.nom.br/
Free Software Activist     FSFLA co-founder     GNU Toolchain Engineer
More tolerance and less prejudice are key for inclusion and diversity.
Excluding neuro-others for not behaving ""normal"" is *not* inclusive!

Reply via email to