From f55cc57c6e3bcb36279682254b9b532049ff3f9d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Torbj=C3=B6rn=20SVENSSON?= <torbjorn.svensson@foss.st.com>
Date: Sun, 13 Oct 2024 20:37:18 +0200
Subject: [PATCH] testsuite: arm: Use effective-target for small-multiply-m*
 tests
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Update test cases to use -mcpu=unset/-march=unset feature introduced in
r15-3606-g7d6c6a0d15c.

gcc/testsuite/ChangeLog:

	* gcc.target/arm/small-multiply-m0-1.c: Use effective-target
	arm_arch_v6m and added option "-march=unset".
	* gcc.target/arm/small-multiply-m0-2.c: Likewise.
	* gcc.target/arm/small-multiply-m0-3.c: Likewise.
	* gcc.target/arm/small-multiply-m0plus-1.c: Likewise.
	* gcc.target/arm/small-multiply-m0plus-2.c: Likewise.
	* gcc.target/arm/small-multiply-m0plus-3.c: Likewise.
	* gcc.target/arm/small-multiply-m1-1.c: Likewise.
	* gcc.target/arm/small-multiply-m1-2.c: Likewise.
	* gcc.target/arm/small-multiply-m1-3.c: Likewise.
	* lib/target-supports.exp: Define effective-target
	arm_cpu_cortex_m0_small, arm_cpu_cortex_m0plus_small and
	arm_cpu_cortex_m1_small.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
---
 gcc/testsuite/gcc.target/arm/small-multiply-m0-1.c     | 6 +++---
 gcc/testsuite/gcc.target/arm/small-multiply-m0-2.c     | 6 +++---
 gcc/testsuite/gcc.target/arm/small-multiply-m0-3.c     | 6 +++---
 gcc/testsuite/gcc.target/arm/small-multiply-m0plus-1.c | 6 +++---
 gcc/testsuite/gcc.target/arm/small-multiply-m0plus-2.c | 6 +++---
 gcc/testsuite/gcc.target/arm/small-multiply-m0plus-3.c | 6 +++---
 gcc/testsuite/gcc.target/arm/small-multiply-m1-1.c     | 6 +++---
 gcc/testsuite/gcc.target/arm/small-multiply-m1-2.c     | 6 +++---
 gcc/testsuite/gcc.target/arm/small-multiply-m1-3.c     | 6 +++---
 gcc/testsuite/lib/target-supports.exp                  | 3 +++
 10 files changed, 30 insertions(+), 27 deletions(-)

diff --git a/gcc/testsuite/gcc.target/arm/small-multiply-m0-1.c b/gcc/testsuite/gcc.target/arm/small-multiply-m0-1.c
index 52c652c1cba3..56253832533d 100644
--- a/gcc/testsuite/gcc.target/arm/small-multiply-m0-1.c
+++ b/gcc/testsuite/gcc.target/arm/small-multiply-m0-1.c
@@ -1,7 +1,7 @@
 /* { dg-do compile } */
-/* { dg-require-effective-target arm_thumb1_ok } */
-/* { dg-skip-if "do not override -mcpu" { *-*-* } { "-mcpu=*" "-march=*" } { "-mcpu=cortex-m0.small-multiply" } } */
-/* { dg-options "-mcpu=cortex-m0.small-multiply -mthumb -O2" } */
+/* { dg-require-effective-target arm_cpu_cortex_m0_small_ok } */
+/* { dg-options "-O2" } */
+/* { dg-add-options arm_cpu_cortex_m0_small } */
 
 int
 test (int a)
diff --git a/gcc/testsuite/gcc.target/arm/small-multiply-m0-2.c b/gcc/testsuite/gcc.target/arm/small-multiply-m0-2.c
index 10d49e9eace6..38e353b4d922 100644
--- a/gcc/testsuite/gcc.target/arm/small-multiply-m0-2.c
+++ b/gcc/testsuite/gcc.target/arm/small-multiply-m0-2.c
@@ -1,7 +1,7 @@
 /* { dg-do compile } */
-/* { dg-require-effective-target arm_thumb1_ok } */
-/* { dg-skip-if "do not override -mcpu" { *-*-* } { "-mcpu=*" "-march=*" } { "-mcpu=cortex-m0.small-multiply" } } */
-/* { dg-options "-mcpu=cortex-m0.small-multiply -mthumb -Os" } */
+/* { dg-require-effective-target arm_cpu_cortex_m0_small_ok } */
+/* { dg-options "-Os" } */
+/* { dg-add-options arm_cpu_cortex_m0_small } */
 
 int
 test (int a)
diff --git a/gcc/testsuite/gcc.target/arm/small-multiply-m0-3.c b/gcc/testsuite/gcc.target/arm/small-multiply-m0-3.c
index b4af511af86c..261961836b90 100644
--- a/gcc/testsuite/gcc.target/arm/small-multiply-m0-3.c
+++ b/gcc/testsuite/gcc.target/arm/small-multiply-m0-3.c
@@ -1,7 +1,7 @@
 /* { dg-do compile } */
-/* { dg-require-effective-target arm_thumb1_ok } */
-/* { dg-skip-if "do not override -mcpu" { *-*-* } { "-mcpu=*" "-march=*" } { "-mcpu=cortex-m0.small-multiply" } } */
-/* { dg-options "-mcpu=cortex-m0.small-multiply -mthumb -Os" } */
+/* { dg-require-effective-target arm_cpu_cortex_m0_small_ok } */
+/* { dg-options "-Os" } */
+/* { dg-add-options arm_cpu_cortex_m0_small } */
 
 int
 test (int a)
diff --git a/gcc/testsuite/gcc.target/arm/small-multiply-m0plus-1.c b/gcc/testsuite/gcc.target/arm/small-multiply-m0plus-1.c
index 59dba7cf4abc..e03cc2d39c0e 100644
--- a/gcc/testsuite/gcc.target/arm/small-multiply-m0plus-1.c
+++ b/gcc/testsuite/gcc.target/arm/small-multiply-m0plus-1.c
@@ -1,7 +1,7 @@
 /* { dg-do compile } */
-/* { dg-require-effective-target arm_thumb1_ok } */
-/* { dg-skip-if "do not override -mcpu" { *-*-* } { "-mcpu=*" "-march=*" } { "-mcpu=cortex-m0plus.small-multiply" } } */
-/* { dg-options "-mcpu=cortex-m0plus.small-multiply -mthumb -O2" } */
+/* { dg-require-effective-target arm_cpu_cortex_m0plus_small_ok } */
+/* { dg-options "-O2" } */
+/* { dg-add-options arm_cpu_cortex_m0plus_small } */
 
 int
 test (int a)
diff --git a/gcc/testsuite/gcc.target/arm/small-multiply-m0plus-2.c b/gcc/testsuite/gcc.target/arm/small-multiply-m0plus-2.c
index 685ef4407766..0d886e1c6774 100644
--- a/gcc/testsuite/gcc.target/arm/small-multiply-m0plus-2.c
+++ b/gcc/testsuite/gcc.target/arm/small-multiply-m0plus-2.c
@@ -1,7 +1,7 @@
 /* { dg-do compile } */
-/* { dg-require-effective-target arm_thumb1_ok } */
-/* { dg-skip-if "do not override -mcpu" { *-*-* } { "-mcpu=*" "-march=*" } { "-mcpu=cortex-m0plus.small-multiply" } } */
-/* { dg-options "-mcpu=cortex-m0plus.small-multiply -mthumb -Os" } */
+/* { dg-require-effective-target arm_cpu_cortex_m0plus_small_ok } */
+/* { dg-options "-Os" } */
+/* { dg-add-options arm_cpu_cortex_m0plus_small } */
 
 int
 test (int a)
diff --git a/gcc/testsuite/gcc.target/arm/small-multiply-m0plus-3.c b/gcc/testsuite/gcc.target/arm/small-multiply-m0plus-3.c
index d24e720fe677..7eea3412c608 100644
--- a/gcc/testsuite/gcc.target/arm/small-multiply-m0plus-3.c
+++ b/gcc/testsuite/gcc.target/arm/small-multiply-m0plus-3.c
@@ -1,7 +1,7 @@
 /* { dg-do compile } */
-/* { dg-require-effective-target arm_thumb1_ok } */
-/* { dg-skip-if "do not override -mcpu" { *-*-* } { "-mcpu=*" "-march=*" } { "-mcpu=cortex-m0plus.small-multiply" } } */
-/* { dg-options "-mcpu=cortex-m0plus.small-multiply -mthumb -Os" } */
+/* { dg-require-effective-target arm_cpu_cortex_m0plus_small_ok } */
+/* { dg-options "-Os" } */
+/* { dg-add-options arm_cpu_cortex_m0plus_small } */
 
 int
 test (int a)
diff --git a/gcc/testsuite/gcc.target/arm/small-multiply-m1-1.c b/gcc/testsuite/gcc.target/arm/small-multiply-m1-1.c
index d966ae955ce8..07587acab6dc 100644
--- a/gcc/testsuite/gcc.target/arm/small-multiply-m1-1.c
+++ b/gcc/testsuite/gcc.target/arm/small-multiply-m1-1.c
@@ -1,7 +1,7 @@
 /* { dg-do compile } */
-/* { dg-require-effective-target arm_thumb1_ok } */
-/* { dg-skip-if "do not override -mcpu" { *-*-* } { "-mcpu=*" "-march=*" } { "-mcpu=cortex-m1.small-multiply" } } */
-/* { dg-options "-mcpu=cortex-m1.small-multiply -mthumb -O2" } */
+/* { dg-require-effective-target arm_cpu_cortex_m1_small_ok } */
+/* { dg-options "-O2" } */
+/* { dg-add-options arm_cpu_cortex_m1_small } */
 
 int
 test (int a)
diff --git a/gcc/testsuite/gcc.target/arm/small-multiply-m1-2.c b/gcc/testsuite/gcc.target/arm/small-multiply-m1-2.c
index 60576bb9ed15..7ef606896fd9 100644
--- a/gcc/testsuite/gcc.target/arm/small-multiply-m1-2.c
+++ b/gcc/testsuite/gcc.target/arm/small-multiply-m1-2.c
@@ -1,7 +1,7 @@
 /* { dg-do compile } */
-/* { dg-require-effective-target arm_thumb1_ok } */
-/* { dg-skip-if "do not override -mcpu" { *-*-* } { "-mcpu=*" "-march=*" } { "-mcpu=cortex-m1.small-multiply" } } */
-/* { dg-options "-mcpu=cortex-m1.small-multiply -mthumb -Os" } */
+/* { dg-require-effective-target arm_cpu_cortex_m1_small_ok } */
+/* { dg-options "-Os" } */
+/* { dg-add-options arm_cpu_cortex_m1_small } */
 
 int
 test (int a)
diff --git a/gcc/testsuite/gcc.target/arm/small-multiply-m1-3.c b/gcc/testsuite/gcc.target/arm/small-multiply-m1-3.c
index c56479d18973..e300f04b1fbf 100644
--- a/gcc/testsuite/gcc.target/arm/small-multiply-m1-3.c
+++ b/gcc/testsuite/gcc.target/arm/small-multiply-m1-3.c
@@ -1,7 +1,7 @@
 /* { dg-do compile } */
-/* { dg-require-effective-target arm_thumb1_ok } */
-/* { dg-skip-if "do not override -mcpu" { *-*-* } { "-mcpu=*" "-march=*" } { "-mcpu=cortex-m1.small-multiply" } } */
-/* { dg-options "-mcpu=cortex-m1.small-multiply -mthumb -Os" } */
+/* { dg-require-effective-target arm_cpu_cortex_m1_small_ok } */
+/* { dg-options "-Os" } */
+/* { dg-add-options arm_cpu_cortex_m1_small } */
 
 int
 test (int a)
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 593f02f6ea30..7cf0287643ec 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -5851,6 +5851,9 @@ foreach { armfunc armflag armdefs } {
 	    xscale_arm "-mcpu=xscale -mfloat-abi=soft -marm" "__XSCALE__ && !__thumb__"
 	    cortex_a57 "-mcpu=cortex-a57" __ARM_ARCH_8A__
 	    cortex_m0 "-mcpu=cortex-m0 -mfloat-abi=soft -mthumb" "__ARM_ARCH_6M__ && __thumb__"
+	    cortex_m0_small "-mcpu=cortex-m0.small-multiply -mfloat-abi=soft -mthumb" "__ARM_ARCH_6M__ && __thumb__"
+	    cortex_m0plus_small "-mcpu=cortex-m0plus.small-multiply -mfloat-abi=soft -mthumb" "__ARM_ARCH_6M__ && __thumb__"
+	    cortex_m1_small "-mcpu=cortex-m1.small-multiply -mfloat-abi=soft -mthumb" "__ARM_ARCH_6M__ && __thumb__"
 	    cortex_m23 "-mcpu=cortex-m23 -mfloat-abi=soft -mthumb" "__ARM_ARCH_8M_BASE__  && __thumb__"
 	} {
     eval [string map [list FUNC $armfunc FLAG $armflag DEFS $armdefs ] {
-- 
GitLab