On 2026-09-04 06:31, Andrea Pinski wrote:
On Thu, Sep 3, 2026 at 3:59 AM <[email protected]> wrote:
From: Kyrylo Tkachov <[email protected]>
The short-it-ifcvt tests verify that -mrestrict-it limits if-conversion.
This option applies only to Thumb-2, but the tests did not select Thumb-2.
An Arm-state test board therefore disabled the option and used the normal
Arm if-conversion limit. The new multi-set diamond conversion then removed
the branch in short-it-ifcvt-1.c and made its Thumb-specific scan fail.
Add -mthumb to both tests. This makes their test mode independent of the
board default and makes them exercise the intended restricted-IT policy.
-mthumb does not force thumb2 either. You need either a or r profiles
to get it too:
/* ARM execution state and M profile don't have [restrict] IT. */
if (!TARGET_THUMB2_P (opts->x_target_flags) || !arm_arch_notm)
opts->x_arm_restrict_it = 0;
So I think you need an explicit `-march=arvm8-a` option here too.
Without below patch, these two tests works just fine on Cortex-M as well.
If you do need to change target, make sure to use the
/* { dg-require-effective-target arm_arch_v8a_ok } */
/* { dg-add-options arm_arch_v8a } */
or similar expressions, however, I think it's enough with the
arm_thumb2_ok guard.
To me, the patch looks correct. If arm_thumb2_ok reports that thumb2 mode
is supported by adding -mthumb, then the test should not require more than
adding -mthumb as well, like Kyrill does.
Kind regards,
Torbjörn
Pushing as obvious.
Thanks,
Kyrill
gcc/testsuite/ChangeLog:
* gcc.target/arm/short-it-ifcvt-1.c: Add -mthumb.
* gcc.target/arm/short-it-ifcvt-2.c: Likewise.
Signed-off-by: Kyrylo Tkachov <[email protected]>
---
gcc/testsuite/gcc.target/arm/short-it-ifcvt-1.c | 2 +-
gcc/testsuite/gcc.target/arm/short-it-ifcvt-2.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/gcc/testsuite/gcc.target/arm/short-it-ifcvt-1.c
b/gcc/testsuite/gcc.target/arm/short-it-ifcvt-1.c
index f3d29b7d234..f4b0049feb5 100644
--- a/gcc/testsuite/gcc.target/arm/short-it-ifcvt-1.c
+++ b/gcc/testsuite/gcc.target/arm/short-it-ifcvt-1.c
@@ -1,6 +1,6 @@
/* Test that ifcvt is not being too aggressive when -mrestrict-it. */
/* { dg-do compile } */
-/* { dg-options "-O2 -mrestrict-it" } */
+/* { dg-options "-O2 -mthumb -mrestrict-it" } */
/* { dg-require-effective-target arm_thumb2_ok } */
int
diff --git a/gcc/testsuite/gcc.target/arm/short-it-ifcvt-2.c
b/gcc/testsuite/gcc.target/arm/short-it-ifcvt-2.c
index 9ac8153069f..54dd3a62867 100644
--- a/gcc/testsuite/gcc.target/arm/short-it-ifcvt-2.c
+++ b/gcc/testsuite/gcc.target/arm/short-it-ifcvt-2.c
@@ -1,6 +1,6 @@
/* Test that ifcvt is not being too aggressive when -mrestrict-it. */
/* { dg-do compile } */
-/* { dg-options "-O2 -mrestrict-it" } */
+/* { dg-options "-O2 -mthumb -mrestrict-it" } */
/* { dg-require-effective-target arm_thumb2_ok } */
int
--
2.50.1 (Apple Git-155)