[COMMITTED] s390: testsuite: Fix bitops-{1, 2}.c and andc-splitter-2.c

Message ID 20250917111435.2364822-2-stefansf@gcc.gnu.org
State Committed
Commit 282c1e682e04507a087392260c77e78a71ec2600
Headers
Series [COMMITTED] s390: testsuite: Fix bitops-{1, 2}.c and andc-splitter-2.c |

Commit Message

Stefan Schulze Frielinghaus Sept. 17, 2025, 11:14 a.m. UTC
  After r16-2649-g0340177d54d tests fail for
gcc.target/s390/arch13/bitops-{1,2}.c since sign extends in conjunction
with (subreg (not a)) are folded, now.  That is, of course, wanted.
Since the original tests were about 32-bit operations, circumvent the
sign extend by not returning a value but rather writing it to memory.

Similar for andc-splitter-2.c sign extends are folded there, too.  Since
the test is not about 32- or 64-bit adjust the scan assembler directives
only.

gcc/testsuite/ChangeLog:

	* gcc.target/s390/arch13/bitops-1.c: Do not return a 32bit value
	but write it to memory.
	* gcc.target/s390/arch13/bitops-2.c: Ditto.
	* gcc.target/s390/md/andc-splitter-2.c: Adjust scan assembler
	directive because sign extends are folded, now.
---
 .../gcc.target/s390/arch13/bitops-1.c         | 22 ++++++++++---------
 .../gcc.target/s390/arch13/bitops-2.c         |  6 +++--
 .../gcc.target/s390/md/andc-splitter-2.c      |  4 ++--
 3 files changed, 18 insertions(+), 14 deletions(-)
  

Patch

diff --git a/gcc/testsuite/gcc.target/s390/arch13/bitops-1.c b/gcc/testsuite/gcc.target/s390/arch13/bitops-1.c
index 8d84655f71c..41915a88f33 100644
--- a/gcc/testsuite/gcc.target/s390/arch13/bitops-1.c
+++ b/gcc/testsuite/gcc.target/s390/arch13/bitops-1.c
@@ -2,10 +2,12 @@ 
 
 /* and with complement */
 
-int
+int i32;
+
+void
 ncrk (int a, int b)
 {
-  return a & ~b;
+  i32 = a & ~b;
 }
 
 /* { dg-final { scan-assembler-times "\tncrk\t" 1 } } */
@@ -20,10 +22,10 @@  ncgrk (long long a, long long b)
 
 /* or with complement */
 
-int
+void
 ocrk (int a, int b)
 {
-  return a | ~b;
+  i32 = a | ~b;
 }
 
 /* { dg-final { scan-assembler-times "\tocrk\t" 1 } } */
@@ -38,10 +40,10 @@  ocgrk (long long a, long long b)
 
 /* nand */
 
-int
+void
 nnrk (int a, int b)
 {
-  return ~(a & b);
+  i32 = ~(a & b);
 }
 
 /* { dg-final { scan-assembler-times "\tnnrk\t" 1 } } */
@@ -56,10 +58,10 @@  nngrk (long long a, long long b)
 
 /* nor */
 
-int
+void
 nork (int a, int b)
 {
-  return ~(a | b);
+  i32 = ~(a | b);
 }
 
 /* { dg-final { scan-assembler-times "\tnork\t" 1 } } */
@@ -74,10 +76,10 @@  nogrk (long long a, long long b)
 
 /* nxor */
 
-int
+void
 nxrk (int a, int b)
 {
-  return ~(a ^ b);
+  i32 = ~(a ^ b);
 }
 
 /* { dg-final { scan-assembler-times "\tnxrk\t" 1 } } */
diff --git a/gcc/testsuite/gcc.target/s390/arch13/bitops-2.c b/gcc/testsuite/gcc.target/s390/arch13/bitops-2.c
index 1bfada3b05a..db05309fcae 100644
--- a/gcc/testsuite/gcc.target/s390/arch13/bitops-2.c
+++ b/gcc/testsuite/gcc.target/s390/arch13/bitops-2.c
@@ -4,6 +4,8 @@ 
 
 /* and with complement */
 
+int i32;
+
 int
 ncrk (int a, int b)
 {
@@ -58,10 +60,10 @@  nngrk (long long a, long long b)
 
 /* nor */
 
-int
+void
 nork (int a, int b)
 {
-  return ~(a | b);
+  i32 = ~(a | b);
 }
 
 /* { dg-final { scan-assembler-times "\tnork\t" 1 } } */
diff --git a/gcc/testsuite/gcc.target/s390/md/andc-splitter-2.c b/gcc/testsuite/gcc.target/s390/md/andc-splitter-2.c
index 03df7b214db..7d098d8d987 100644
--- a/gcc/testsuite/gcc.target/s390/md/andc-splitter-2.c
+++ b/gcc/testsuite/gcc.target/s390/md/andc-splitter-2.c
@@ -37,8 +37,8 @@  unsigned int andc_pp(unsigned int *a, unsigned int *b)
 /* { dg-final { scan-assembler ":36:.\* \{\\*andsi3_\(esa\|zarch\)\}" } } */
 /* { dg-final { scan-assembler ":36:.\* \{\\*xorsi3\}" } } */
 
-/* { dg-final { scan-assembler-times "\tnr\?k\?\t" 4 } } */
-/* { dg-final { scan-assembler-times "\txr\?k\?\t" 4 } } */
+/* { dg-final { scan-assembler-times "\tng\?r\?k\?\t" 4 } } */
+/* { dg-final { scan-assembler-times "\txg\?r\?k\?\t" 4 } } */
 
 int
 main (void)