public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] testsuite: fix the condition bug in tsvc s176
@ 2023-06-08 11:23 Lehua Ding
  2023-06-09  8:58 ` Richard Biener
  0 siblings, 1 reply; 6+ messages in thread
From: Lehua Ding @ 2023-06-08 11:23 UTC (permalink / raw)
  To: gcc-patches, mliska

Hi,

This patch fixes the problem that the loop in the tsvc s176 function is
optimized and removed because `iterations/LEN_1D` is 0 (where iterations
is set to 10000, LEN_1D is set to 32000 in tsvc.h).

This testcase passed on x86 and AArch64 system.

Best,
Lehua

gcc/testsuite/ChangeLog:

        * gcc.dg/vect/tsvc/vect-tsvc-s176.c: adjust iterations

---
 gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s176.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s176.c b/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s176.c
index 79faf7fdb9e4..365e5205982b 100644
--- a/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s176.c
+++ b/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s176.c
@@ -14,7 +14,7 @@ real_t s176(struct args_t * func_args)
     initialise_arrays(__func__);
 
     int m = LEN_1D/2;
-    for (int nl = 0; nl < 4*(iterations/LEN_1D); nl++) {
+    for (int nl = 0; nl < 4*(10*iterations/LEN_1D); nl++) {
         for (int j = 0; j < (LEN_1D/2); j++) {
             for (int i = 0; i < m; i++) {
                 a[i] += b[i+m-j-1] * c[j];
@@ -39,4 +39,4 @@ int main (int argc, char **argv)
   return 0;
 }
 
-/* { dg-final { scan-tree-dump "vectorized 1 loops" "vect" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump "vectorized 1 loops" "vect" } } */
-- 
2.36.1


^ permalink raw reply	[flat|nested] 6+ messages in thread
* Re: [PATCH] testsuite: fix the condition bug in tsvc s176
@ 2023-06-09  9:57 Lehua Ding
  2023-06-09 11:56 ` Richard Biener
  0 siblings, 1 reply; 6+ messages in thread
From: Lehua Ding @ 2023-06-09  9:57 UTC (permalink / raw)
  To: richard.guenther; +Cc: gcc-patches

> It's odd that the checksum doesn't depend on the number of iterations done ...

This is because the difference between the calculated result (32063.902344) and
the expected result (32000.000000) is small. The current check is that the result
is considered correct as long as the `value/expected` ratio is between 0.99f and
1.01f. I'm not sure if this check is enough, but I should also update the expected
result to 32063.902344 (the same without vectorized).

Best,
Lehua

gcc/testsuite/ChangeLog:

        * gcc.dg/vect/tsvc/tsvc.h:
        * gcc.dg/vect/tsvc/vect-tsvc-s176.c:

---
 gcc/testsuite/gcc.dg/vect/tsvc/tsvc.h           | 2 +-
 gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s176.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/vect/tsvc/tsvc.h b/gcc/testsuite/gcc.dg/vect/tsvc/tsvc.h
index cd39c041903d..d910c384fc83 100644
--- a/gcc/testsuite/gcc.dg/vect/tsvc/tsvc.h
+++ b/gcc/testsuite/gcc.dg/vect/tsvc/tsvc.h
@@ -1164,7 +1164,7 @@ real_t get_expected_result(const char * name)
     } else if (!strcmp(name, "s175")) {
 	return 32009.023438f;
     } else if (!strcmp(name, "s176")) {
-	return 32000.f;
+	return 32063.902344f;
     } else if (!strcmp(name, "s211")) {
 	return 63983.308594f;
     } else if (!strcmp(name, "s212")) {
diff --git a/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s176.c b/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s176.c
index 79faf7fdb9e4..365e5205982b 100644
--- a/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s176.c
+++ b/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s176.c
@@ -14,7 +14,7 @@ real_t s176(struct args_t * func_args)
     initialise_arrays(__func__);
 
     int m = LEN_1D/2;
-    for (int nl = 0; nl < 4*(iterations/LEN_1D); nl++) {
+    for (int nl = 0; nl < 4*(10*iterations/LEN_1D); nl++) {
         for (int j = 0; j < (LEN_1D/2); j++) {
             for (int i = 0; i < m; i++) {
                 a[i] += b[i+m-j-1] * c[j];
@@ -39,4 +39,4 @@ int main (int argc, char **argv)
   return 0;
 }
 
-/* { dg-final { scan-tree-dump "vectorized 1 loops" "vect" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump "vectorized 1 loops" "vect" } } */
-- 
2.36.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-06-09 13:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-08 11:23 [PATCH] testsuite: fix the condition bug in tsvc s176 Lehua Ding
2023-06-09  8:58 ` Richard Biener
2023-06-09  9:57 Lehua Ding
2023-06-09 11:56 ` Richard Biener
2023-06-09 13:29   ` Jeff Law
2023-06-09 13:49     ` Lehua Ding

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).