public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/marxin/heads/loop-unswitch-improvement)] Add new test.
@ 2021-11-19 13:53 Martin Liska
0 siblings, 0 replies; 3+ messages in thread
From: Martin Liska @ 2021-11-19 13:53 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:3702ed4e29a39953ce3f17e392d195575f4d30fe
commit 3702ed4e29a39953ce3f17e392d195575f4d30fe
Author: Martin Liska <mliska@suse.cz>
Date: Fri Nov 19 14:51:49 2021 +0100
Add new test.
Diff:
---
gcc/testsuite/gcc.dg/loop-unswitch-8.c | 2 +-
gcc/testsuite/gcc.dg/loop-unswitch-9.c | 27 +++++++++++++++++++++++++++
2 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/gcc/testsuite/gcc.dg/loop-unswitch-8.c b/gcc/testsuite/gcc.dg/loop-unswitch-8.c
index 37692966fc5..7738a24d849 100644
--- a/gcc/testsuite/gcc.dg/loop-unswitch-8.c
+++ b/gcc/testsuite/gcc.dg/loop-unswitch-8.c
@@ -28,4 +28,4 @@ foo(double *a, double *b, double *c, double *d, double *r, int size, int order)
return 0;
}
-/* { dg-final { scan-tree-dump-times ";; Unswitching loop with condition: order" 1 "unswitch" } } */
+/* { dg-final { scan-tree-dump-times ";; Unswitching loop with condition: order" 3 "unswitch" } } */
diff --git a/gcc/testsuite/gcc.dg/loop-unswitch-9.c b/gcc/testsuite/gcc.dg/loop-unswitch-9.c
new file mode 100644
index 00000000000..46c93605dc8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/loop-unswitch-9.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -funswitch-loops -fdump-tree-unswitch-details" } */
+
+int
+foo(double *a, double *b, double *c, double *d, double *r, int size, int order)
+{
+ for (int i = 0; i < size; i++)
+ {
+ double tmp;
+
+ if (order == 1)
+ tmp = -8 * a[i];
+ else
+ {
+ if (order == 2)
+ tmp = -4 * b[i];
+ else
+ tmp = a[i];
+ }
+
+ r[i] = 3.4f * tmp + d[i];
+ }
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times ";; Unswitching loop with condition: order" 2 "unswitch" } } */
^ permalink raw reply [flat|nested] 3+ messages in thread
* [gcc(refs/users/marxin/heads/loop-unswitch-improvement)] Add new test.
@ 2021-11-22 12:45 Martin Liska
0 siblings, 0 replies; 3+ messages in thread
From: Martin Liska @ 2021-11-22 12:45 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:fb3c2f6efdbba61aeaf162d421008ec5b40c9854
commit fb3c2f6efdbba61aeaf162d421008ec5b40c9854
Author: Martin Liska <mliska@suse.cz>
Date: Fri Nov 19 14:51:49 2021 +0100
Add new test.
Diff:
---
gcc/testsuite/gcc.dg/loop-unswitch-8.c | 2 +-
gcc/testsuite/gcc.dg/loop-unswitch-9.c | 27 +++++++++++++++++++++++++++
2 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/gcc/testsuite/gcc.dg/loop-unswitch-8.c b/gcc/testsuite/gcc.dg/loop-unswitch-8.c
index 37692966fc5..7738a24d849 100644
--- a/gcc/testsuite/gcc.dg/loop-unswitch-8.c
+++ b/gcc/testsuite/gcc.dg/loop-unswitch-8.c
@@ -28,4 +28,4 @@ foo(double *a, double *b, double *c, double *d, double *r, int size, int order)
return 0;
}
-/* { dg-final { scan-tree-dump-times ";; Unswitching loop with condition: order" 1 "unswitch" } } */
+/* { dg-final { scan-tree-dump-times ";; Unswitching loop with condition: order" 3 "unswitch" } } */
diff --git a/gcc/testsuite/gcc.dg/loop-unswitch-9.c b/gcc/testsuite/gcc.dg/loop-unswitch-9.c
new file mode 100644
index 00000000000..46c93605dc8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/loop-unswitch-9.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -funswitch-loops -fdump-tree-unswitch-details" } */
+
+int
+foo(double *a, double *b, double *c, double *d, double *r, int size, int order)
+{
+ for (int i = 0; i < size; i++)
+ {
+ double tmp;
+
+ if (order == 1)
+ tmp = -8 * a[i];
+ else
+ {
+ if (order == 2)
+ tmp = -4 * b[i];
+ else
+ tmp = a[i];
+ }
+
+ r[i] = 3.4f * tmp + d[i];
+ }
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times ";; Unswitching loop with condition: order" 2 "unswitch" } } */
^ permalink raw reply [flat|nested] 3+ messages in thread
* [gcc(refs/users/marxin/heads/loop-unswitch-improvement)] Add new test.
@ 2021-11-19 14:34 Martin Liska
0 siblings, 0 replies; 3+ messages in thread
From: Martin Liska @ 2021-11-19 14:34 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:e84e4fdf8c428eac5e017e713eaa33bfa3f71fcf
commit e84e4fdf8c428eac5e017e713eaa33bfa3f71fcf
Author: Martin Liska <mliska@suse.cz>
Date: Fri Nov 19 14:51:49 2021 +0100
Add new test.
Diff:
---
gcc/testsuite/gcc.dg/loop-unswitch-8.c | 2 +-
gcc/testsuite/gcc.dg/loop-unswitch-9.c | 27 +++++++++++++++++++++++++++
2 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/gcc/testsuite/gcc.dg/loop-unswitch-8.c b/gcc/testsuite/gcc.dg/loop-unswitch-8.c
index 37692966fc5..7738a24d849 100644
--- a/gcc/testsuite/gcc.dg/loop-unswitch-8.c
+++ b/gcc/testsuite/gcc.dg/loop-unswitch-8.c
@@ -28,4 +28,4 @@ foo(double *a, double *b, double *c, double *d, double *r, int size, int order)
return 0;
}
-/* { dg-final { scan-tree-dump-times ";; Unswitching loop with condition: order" 1 "unswitch" } } */
+/* { dg-final { scan-tree-dump-times ";; Unswitching loop with condition: order" 3 "unswitch" } } */
diff --git a/gcc/testsuite/gcc.dg/loop-unswitch-9.c b/gcc/testsuite/gcc.dg/loop-unswitch-9.c
new file mode 100644
index 00000000000..46c93605dc8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/loop-unswitch-9.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -funswitch-loops -fdump-tree-unswitch-details" } */
+
+int
+foo(double *a, double *b, double *c, double *d, double *r, int size, int order)
+{
+ for (int i = 0; i < size; i++)
+ {
+ double tmp;
+
+ if (order == 1)
+ tmp = -8 * a[i];
+ else
+ {
+ if (order == 2)
+ tmp = -4 * b[i];
+ else
+ tmp = a[i];
+ }
+
+ r[i] = 3.4f * tmp + d[i];
+ }
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times ";; Unswitching loop with condition: order" 2 "unswitch" } } */
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-11-22 12:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-19 13:53 [gcc(refs/users/marxin/heads/loop-unswitch-improvement)] Add new test Martin Liska
2021-11-19 14:34 Martin Liska
2021-11-22 12:45 Martin Liska
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).