From 7c7e630cd0b678a348ee9600f637f71293882d2e Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Sat, 16 Nov 2024 08:42:01 -0700 Subject: [PATCH] Fix various sh tests to work with c23 A few SH tests want to create a bool typedef which doesn't work for c23. Easiest fix which should have no impact on the test behavior would be to just change the name of the typedef so that doesn't conflict. One test has a crazy function signature (similar to the PRU test someone just fixed up). For that I'm using -std=gnu17. Pushing to the trunk. testsuite/ * gcc.target/sh/pr51244-15.c: Use "mybool" rather than "bool". * gcc.target/sh/pr52933-1.c: Similarly. * gcc.target/sh/pr54089-1.c: Similarly. * gcc.target/sh/pr54089-7.c: Similarly. * gcc.target/sh/pr54089-8.c: Similarly. * gcc.target/sh/pr54089-9.c: Similarly. * gcc.target/sh/pr64366.c: Use -std=gnu17. --- gcc/testsuite/gcc.target/sh/pr51244-15.c | 14 ++++---- gcc/testsuite/gcc.target/sh/pr52933-1.c | 44 ++++++++++++------------ gcc/testsuite/gcc.target/sh/pr54089-1.c | 42 +++++++++++----------- gcc/testsuite/gcc.target/sh/pr54089-7.c | 12 +++---- gcc/testsuite/gcc.target/sh/pr54089-8.c | 40 ++++++++++----------- gcc/testsuite/gcc.target/sh/pr54089-9.c | 12 +++---- gcc/testsuite/gcc.target/sh/pr64366.c | 2 +- 7 files changed, 83 insertions(+), 83 deletions(-) diff --git a/gcc/testsuite/gcc.target/sh/pr51244-15.c b/gcc/testsuite/gcc.target/sh/pr51244-15.c index 8b9d57bf8d3..036147b87a4 100644 --- a/gcc/testsuite/gcc.target/sh/pr51244-15.c +++ b/gcc/testsuite/gcc.target/sh/pr51244-15.c @@ -12,14 +12,14 @@ /* { dg-final { scan-assembler-times "movt" 3 { target { sh2a } } } } */ /* { dg-final { scan-assembler-times "movrt" 3 { target { sh2a } } } } */ -typedef char bool; +typedef char mybool; int test_0 (int a, int b, int c, int* d) { /* non SH2A: 1x tst, 1x movt, 1x xor SH2A: 1x tst, 1x movrt */ - bool x = a == 0; + mybool x = a == 0; d[2] = !x; return x ? b : c; } @@ -28,7 +28,7 @@ int test_1 (int a, int b, int c, int* d) { /* 1x tst, 1x movt */ - bool x = a != 0; + mybool x = a != 0; d[2] = !x; return x ? b : c; } @@ -39,7 +39,7 @@ test_2 (int a, int b, int c, char* d) /* Check that there is no sign/zero-extension before the store. non SH2A: 1x tst, 1x movt, 1x xor SH2A: 1x tst, 1x movrt */ - bool x = a == 0; + mybool x = a == 0; d[2] = !x; return x ? b : c; } @@ -49,7 +49,7 @@ test_3 (int a, int b, int c, char* d) { /* Check that there is no sign/zero-extension before the store. 1x tst, 1x movt */ - bool x = a != 0; + mybool x = a != 0; d[2] = !x; return x ? b : c; } @@ -58,7 +58,7 @@ int test_4 (int a, int b, int c, char* d) { /* 1x tst, 1x movt */ - bool x = a != 0; + mybool x = a != 0; d[2] = !x; return !x ? b : c; } @@ -68,7 +68,7 @@ test_5 (int a, int b, int c, char* d) { /* non SH2A: 1x tst, 1x movt, 1x xor SH2A: 1x tst, 1x movrt */ - bool x = a == 0; + mybool x = a == 0; d[2] = !x; return !x ? b : c; } diff --git a/gcc/testsuite/gcc.target/sh/pr52933-1.c b/gcc/testsuite/gcc.target/sh/pr52933-1.c index 81aa94fc8f0..b21b0ec52e7 100644 --- a/gcc/testsuite/gcc.target/sh/pr52933-1.c +++ b/gcc/testsuite/gcc.target/sh/pr52933-1.c @@ -12,18 +12,18 @@ /* { dg-final { scan-assembler-times "negc" 10 { target { ! sh2a } } } } */ /* { dg-final { scan-assembler-times "movrt" 10 { target { sh2a } } } } */ -typedef unsigned char bool; +typedef unsigned char mybool; int other_func_a (int, int); int other_func_b (int, int); -bool +mybool test_00 (int a, int b) { return (a ^ b) >= 0; } -bool +mybool test_01 (int a, int b) { return (a ^ b) < 0; @@ -53,7 +53,7 @@ test_04 (int a, int b) return (a ^ b) >= 0 ? -20 : -40; } -bool +mybool test_05 (int a, int b) { return (a ^ b) < 0; @@ -65,7 +65,7 @@ test_06 (int a, int b) return (a ^ b) < 0 ? -20 : -40; } -bool +mybool test_07 (int a, int b) { return (a < 0) == (b < 0); @@ -77,7 +77,7 @@ test_08 (int a, int b) return (a < 0) == (b < 0) ? -20 : -40; } -bool +mybool test_09 (int a, int b) { return (a < 0) != (b < 0); @@ -89,7 +89,7 @@ test_10 (int a, int b) return (a < 0) != (b < 0) ? -20 : -40; } -bool +mybool test_11 (int a, int b) { return (a >= 0) ^ (b < 0); @@ -101,7 +101,7 @@ test_12 (int a, int b) return (a >= 0) ^ (b < 0) ? -20 : -40; } -bool +mybool test_13 (int a, int b) { return !((a >= 0) ^ (b < 0)); @@ -113,7 +113,7 @@ test_14 (int a, int b) return !((a >= 0) ^ (b < 0)) ? -20 : -40; } -bool +mybool test_15 (int a, int b) { return (a & 0x80000000) == (b & 0x80000000); @@ -125,7 +125,7 @@ test_16 (int a, int b) return (a & 0x80000000) == (b & 0x80000000) ? -20 : -40; } -bool +mybool test_17 (int a, int b) { return (a & 0x80000000) != (b & 0x80000000); @@ -164,20 +164,20 @@ test_22 (int a, int b, int c, int d) return other_func_b (c, d); } -bool +mybool test_23 (int a, int b, int c, int d) { /* Should emit 2x div0s. */ return ((a < 0) == (b < 0)) | ((c < 0) == (d < 0)); } -bool +mybool test_24 (int a, int b) { return a >= 0 != b >= 0; } -bool +mybool test_25 (int a, int b) { return !(a < 0 != b < 0); @@ -215,42 +215,42 @@ test_30 (int a, int b) // ------------------------------------------------------- -bool +mybool test_31 (int a, int b) { /* 2x exts.w, div0s */ return ((a & 0x8000) ^ (b & 0x8000)) != 0; } -bool +mybool test_32 (int a, int b) { /* 2x exts.w, div0s */ return (a & 0x8000) != (b & 0x8000); } -bool +mybool test_33 (int a, int b) { /* 2x add/shll, div0s */ return ((a & (1<<30)) ^ (b & (1<<30))) != 0; } -bool +mybool test_34 (int a, int b) { /* 2x exts.b, div0s */ return (a & 0x80) != (b & 0x80); } -bool +mybool test_35 (signed char a, signed char b) { /* 2x exts.b, div0s */ return (a < 0) != (b < 0); } -bool +mybool test_36 (short a, short b) { /* 2x exts.w, div0s */ @@ -264,21 +264,21 @@ test_37 (short a, short b) return (a < 0) != (b < 0) ? 40 : -10; } -bool +mybool test_38 (int a, int b) { /* 2x shll8, div0s */ return ((a & (1<<23)) ^ (b & (1<<23))) != 0; } -bool +mybool test_39 (int a, int b) { /* 2x shll2, div0s */ return ((a & (1<<29)) ^ (b & (1<<29))) != 0; } -bool +mybool test_40 (short a, short b) { /* 2x exts.w, div0s, negc */ diff --git a/gcc/testsuite/gcc.target/sh/pr54089-1.c b/gcc/testsuite/gcc.target/sh/pr54089-1.c index 8b6a729f64c..a85e52a626c 100644 --- a/gcc/testsuite/gcc.target/sh/pr54089-1.c +++ b/gcc/testsuite/gcc.target/sh/pr54089-1.c @@ -7,7 +7,7 @@ /* { dg-final { scan-assembler-not "and\t#1" } } */ /* { dg-final { scan-assembler-not "cmp/pl" } } */ -typedef char bool; +typedef char mybool; long long test_00 (long long a) @@ -18,70 +18,70 @@ test_00 (long long a) unsigned int test_01 (unsigned int a, int b, int c) { - bool r = b == c; + mybool r = b == c; return ((a >> 1) | (r << 31)); } unsigned int test_02 (unsigned int a, int b, int c) { - bool r = b == c; + mybool r = b == c; return ((a >> 2) | (r << 31)); } unsigned int test_03 (unsigned int a, int b, int c) { - bool r = b == c; + mybool r = b == c; return ((a >> 3) | (r << 31)); } unsigned int test_04 (unsigned int a, int b, int c) { - bool r = b == c; + mybool r = b == c; return ((a >> 4) | (r << 31)); } unsigned int test_05 (unsigned int a, int b, int c) { - bool r = b == c; + mybool r = b == c; return ((a >> 5) | (r << 31)); } unsigned int test_06 (unsigned int a, int b, int c) { - bool r = b == c; + mybool r = b == c; return ((a >> 6) | (r << 31)); } unsigned int test_07 (unsigned int a, int b, int c) { - bool r = b == c; + mybool r = b == c; return ((a >> 7) | (r << 31)); } unsigned int test_08 (unsigned int a, int b, int c) { - bool r = b == c; + mybool r = b == c; return ((a >> 8) | (r << 31)); } unsigned int test_09 (unsigned int a, int b, int c) { - bool r = b == c; + mybool r = b == c; return ((a >> 31) | (r << 31)); } int test_10 (int a, int b) { - bool r = a == b; + mybool r = a == b; return r << 31; } @@ -108,70 +108,70 @@ unsigned int test_14 (unsigned int a, int b) { /* 1x shll, 1x rotcr */ - bool r = b < 0; + mybool r = b < 0; return ((a >> 1) | (r << 31)); } unsigned int test_15 (unsigned int a, int b, int c) { - bool r = b != c; + mybool r = b != c; return ((a >> 1) | (r << 31)); } unsigned int test_16 (unsigned int a, int b, int c) { - bool r = b != c; + mybool r = b != c; return ((a >> 2) | (r << 31)); } unsigned int test_17 (unsigned int a, int b, int c) { - bool r = b != c; + mybool r = b != c; return ((a >> 3) | (r << 31)); } unsigned int test_18 (unsigned int a, int b, int c) { - bool r = b != c; + mybool r = b != c; return ((a >> 4) | (r << 31)); } unsigned int test_19 (unsigned int a, int b, int c) { - bool r = b != c; + mybool r = b != c; return ((a >> 5) | (r << 31)); } unsigned int test_20 (unsigned int a, int b, int c) { - bool r = b != c; + mybool r = b != c; return ((a >> 6) | (r << 31)); } unsigned int test_21 (unsigned int a, int b, int c) { - bool r = b != c; + mybool r = b != c; return ((a >> 7) | (r << 31)); } unsigned int test_22 (unsigned int a, int b, int c) { - bool r = b != c; + mybool r = b != c; return ((a >> 8) | (r << 31)); } unsigned int test_23 (unsigned int a, int b, int c) { - bool r = b != c; + mybool r = b != c; return ((a >> 31) | (r << 31)); } diff --git a/gcc/testsuite/gcc.target/sh/pr54089-7.c b/gcc/testsuite/gcc.target/sh/pr54089-7.c index b302364979a..93b286b155a 100644 --- a/gcc/testsuite/gcc.target/sh/pr54089-7.c +++ b/gcc/testsuite/gcc.target/sh/pr54089-7.c @@ -7,7 +7,7 @@ /* { dg-final { scan-assembler-not "rotr" } } */ /* { dg-final { scan-assembler-not "and" } } */ -typedef char bool; +typedef char mybool; int test_00 (int* a, int* b) @@ -16,7 +16,7 @@ test_00 (int* a, int* b) unsigned int r = 0; for (i = 0; i < 16; ++i) { - bool t = a[i] == b[i]; + mybool t = a[i] == b[i]; r = (t << 31) | (r >> 1); } return r; @@ -29,7 +29,7 @@ test_01 (int* a, int* b) unsigned int r = 0; for (i = 0; i < 16; ++i) { - bool t = a[i] == b[i]; + mybool t = a[i] == b[i]; r = (t << 31) | (r >> 2); } return r; @@ -42,20 +42,20 @@ test_02 (int* a, int* b) unsigned int r = 0; for (i = 0; i < 16; ++i) { - bool t = a[i] == b[i]; + mybool t = a[i] == b[i]; r = (t << 31) | (r >> 3); } return r; } unsigned int -test_03 (const bool* a) +test_03 (const mybool* a) { int i; unsigned int r = 0; for (i = 0; i < 32; ++i) { - bool t = a[i]; + mybool t = a[i]; r = (t << 31) | (r >> 1); } return r; diff --git a/gcc/testsuite/gcc.target/sh/pr54089-8.c b/gcc/testsuite/gcc.target/sh/pr54089-8.c index 6af1750daf2..528623741f2 100644 --- a/gcc/testsuite/gcc.target/sh/pr54089-8.c +++ b/gcc/testsuite/gcc.target/sh/pr54089-8.c @@ -3,7 +3,7 @@ /* { dg-options "-O2" } */ /* { dg-final { scan-assembler-times "rotcl" 28 } } */ -typedef char bool; +typedef char mybool; long long test_00 (long long a) @@ -14,63 +14,63 @@ test_00 (long long a) unsigned int test_01 (unsigned int a, int b, int c) { - bool r = b == c; + mybool r = b == c; return ((a << 1) | r); } unsigned int test_02 (unsigned int a, int b, int c) { - bool r = b == c; + mybool r = b == c; return ((a << 2) | r); } unsigned int test_03 (unsigned int a, int b, int c) { - bool r = b == c; + mybool r = b == c; return ((a << 3) | r); } unsigned int test_04 (unsigned int a, int b, int c) { - bool r = b == c; + mybool r = b == c; return ((a << 4) | r); } unsigned int test_05 (unsigned int a, int b, int c) { - bool r = b == c; + mybool r = b == c; return ((a << 5) | r); } unsigned int test_06 (unsigned int a, int b, int c) { - bool r = b == c; + mybool r = b == c; return ((a << 6) | r); } unsigned int test_07 (unsigned int a, int b, int c) { - bool r = b == c; + mybool r = b == c; return ((a << 7) | r); } unsigned int test_08 (unsigned int a, int b, int c) { - bool r = b == c; + mybool r = b == c; return ((a << 8) | r); } unsigned int test_09 (unsigned int a, int b, int c) { - bool r = b == c; + mybool r = b == c; return ((a << 31) | r); } @@ -99,70 +99,70 @@ unsigned int test_13 (unsigned int a, int b) { /* 1x shll, 1x rotcl */ - bool r = b < 0; + mybool r = b < 0; return (a << 1) | r; } unsigned int test_14 (unsigned int a, int b, int c) { - bool r = b != c; + mybool r = b != c; return ((a << 1) | r); } unsigned int test_15 (unsigned int a, int b, int c) { - bool r = b != c; + mybool r = b != c; return ((a << 11) | r); } unsigned int test_16 (unsigned int a, int b, int c) { - bool r = b != c; + mybool r = b != c; return ((a << 3) | r); } unsigned int test_17 (unsigned int a, int b, int c) { - bool r = b != c; + mybool r = b != c; return ((a << 4) | r); } unsigned int test_18 (unsigned int a, int b, int c) { - bool r = b != c; + mybool r = b != c; return ((a << 5) | r); } unsigned int test_19 (unsigned int a, int b, int c) { - bool r = b != c; + mybool r = b != c; return ((a << 6) | r); } unsigned int test_20 (unsigned int a, int b, int c) { - bool r = b != c; + mybool r = b != c; return ((a << 7) | r); } unsigned int test_21 (unsigned int a, int b, int c) { - bool r = b != c; + mybool r = b != c; return ((a << 8) | r); } unsigned int test_22 (unsigned int a, int b, int c) { - bool r = b != c; + mybool r = b != c; return ((a << 31) | r); } diff --git a/gcc/testsuite/gcc.target/sh/pr54089-9.c b/gcc/testsuite/gcc.target/sh/pr54089-9.c index 3ced51eecf4..290f60e2b69 100644 --- a/gcc/testsuite/gcc.target/sh/pr54089-9.c +++ b/gcc/testsuite/gcc.target/sh/pr54089-9.c @@ -7,7 +7,7 @@ /* { dg-final { scan-assembler-not "rotl" } } */ /* { dg-final { scan-assembler-not "and" } } */ -typedef char bool; +typedef char mybool; int test_00 (int* a, int* b) @@ -16,7 +16,7 @@ test_00 (int* a, int* b) int r = 0; for (i = 0; i < 16; ++i) { - bool t = a[i] == b[i]; + mybool t = a[i] == b[i]; r = (r << 1) | t; } return r; @@ -29,7 +29,7 @@ test_01 (int* a, int* b) int r = 0; for (i = 0; i < 16; ++i) { - bool t = a[i] == b[i]; + mybool t = a[i] == b[i]; r = (r << 2) | t; } return r; @@ -42,20 +42,20 @@ test_02 (int* a, int* b) int r = 0; for (i = 0; i < 16; ++i) { - bool t = a[i] == b[i]; + mybool t = a[i] == b[i]; r = (r << 3) | t; } return r; } int -test_03 (const bool* a) +test_03 (const mybool* a) { int i; int r = 0; for (i = 0; i < 16; ++i) { - bool t = a[i]; + mybool t = a[i]; r = (r << 1) | (t & 1); } return r; diff --git a/gcc/testsuite/gcc.target/sh/pr64366.c b/gcc/testsuite/gcc.target/sh/pr64366.c index f78b133bbed..4fe29c38e91 100644 --- a/gcc/testsuite/gcc.target/sh/pr64366.c +++ b/gcc/testsuite/gcc.target/sh/pr64366.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mlra" } */ +/* { dg-options "-O2 -mlra -std=gnu17" } */ typedef int int8_t __attribute__ ((__mode__ (__QI__))); typedef int int16_t __attribute__ ((__mode__ (__HI__)));