public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-6414] RISC-V: testsuite: Fix strcmp-run.c test.
@ 2023-12-11 14:32 Robin Dapp
0 siblings, 0 replies; only message in thread
From: Robin Dapp @ 2023-12-11 14:32 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:b1474da1bb9cc829cbf597f9a51393795108419f
commit r14-6414-gb1474da1bb9cc829cbf597f9a51393795108419f
Author: Robin Dapp <rdapp@ventanamicro.com>
Date: Mon Dec 11 14:16:04 2023 +0100
RISC-V: testsuite: Fix strcmp-run.c test.
This fixes expectations in the strcmp-run test which would sometimes
fail with newlib. The test expects libc strcmp return values and
asserts the vectorized result is similar to those. Therefore hard-code
the expected results instead of relying on a strcmp call.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/autovec/builtin/strcmp-run.c: Adjust test
expectation and target selector.
* gcc.target/riscv/rvv/autovec/builtin/strlen-run.c: Adjust
target selector.
* gcc.target/riscv/rvv/autovec/builtin/strncmp-run.c: Ditto.
Diff:
---
.../riscv/rvv/autovec/builtin/strcmp-run.c | 25 +++++++++++-----------
.../riscv/rvv/autovec/builtin/strlen-run.c | 2 +-
.../riscv/rvv/autovec/builtin/strncmp-run.c | 2 +-
3 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/builtin/strcmp-run.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/builtin/strcmp-run.c
index 6dec7da91c1..43c9e0f42ed 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/builtin/strcmp-run.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/builtin/strcmp-run.c
@@ -1,8 +1,6 @@
-/* { dg-do run } */
+/* { dg-do run { target { riscv_v } } } */
/* { dg-additional-options "-O3 -minline-strcmp" } */
-#include <string.h>
-
int
__attribute__ ((noipa))
foo (const char *s, const char *t)
@@ -10,23 +8,26 @@ foo (const char *s, const char *t)
return __builtin_strcmp (s, t);
}
-int
-__attribute__ ((noipa, optimize ("0")))
-foo2 (const char *s, const char *t)
-{
- return strcmp (s, t);
-}
-
#define SZ 10
-int main ()
+int
+main ()
{
const char *s[SZ]
= {"", "asdf", "0", "\0", "!@#$%***m1123fdnmoi43",
"a", "z", "1", "9", "12345678901234567889012345678901234567890"};
+ const int ref[SZ * SZ]
+ = {0, -97, -48, 0, -33, -97, -122, -49, -57, -49, 97, 0, 49, 97, 64,
+ 115, -25, 48, 40, 48, 48, -49, 0, 48, 15, -49, -74, -1, -9, -1,
+ 0, -97, -48, 0, -33, -97, -122, -49, -57, -49, 33, -64, -15, 33, 0,
+ -64, -89, -16, -24, -16, 97, -115, 49, 97, 64, 0, -25, 48, 40, 48,
+ 122, 25, 74, 122, 89, 25, 0, 73, 65, 73, 49, -48, 1, 49, 16,
+ -48, -73, 0, -8, -50, 57, -40, 9, 57, 24, -40, -65, 8, 0, 8,
+ 49, -48, 1, 49, 16, -48, -73, 50, -8, 0};
+
for (int i = 0; i < SZ; i++)
for (int j = 0; j < SZ; j++)
- if (foo (s[i], s[j]) != foo2 (s[i], s[j]))
+ if (foo (s[i], s[j]) != ref [i * SZ + j])
__builtin_abort ();
}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/builtin/strlen-run.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/builtin/strlen-run.c
index d29297a5f86..deeb8401ef1 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/builtin/strlen-run.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/builtin/strlen-run.c
@@ -1,4 +1,4 @@
-/* { dg-do run } */
+/* { dg-do run { target { riscv_v } } } */
/* { dg-additional-options "-O3 -minline-strlen" } */
int
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/builtin/strncmp-run.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/builtin/strncmp-run.c
index 8d1471a3a13..b7cd94254d9 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/builtin/strncmp-run.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/builtin/strncmp-run.c
@@ -1,4 +1,4 @@
-/* { dg-do run } */
+/* { dg-do run { target { riscv_v } } } */
/* { dg-additional-options "-O3 -minline-strcmp" } */
#include <string.h>
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-12-11 14:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-11 14:32 [gcc r14-6414] RISC-V: testsuite: Fix strcmp-run.c test Robin Dapp
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).