public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/marxin/heads/loop-unswitching-switch-v5)] Add new test-case.
@ 2021-11-08 15:36 Martin Liska
0 siblings, 0 replies; only message in thread
From: Martin Liska @ 2021-11-08 15:36 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:e90e6fe2afcadfeda248a40b71e1941c87f0a9d0
commit e90e6fe2afcadfeda248a40b71e1941c87f0a9d0
Author: Martin Liska <mliska@suse.cz>
Date: Mon Nov 8 16:36:05 2021 +0100
Add new test-case.
Diff:
---
gcc/testsuite/gcc.dg/loop-unswitch-10.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/gcc/testsuite/gcc.dg/loop-unswitch-10.c b/gcc/testsuite/gcc.dg/loop-unswitch-10.c
new file mode 100644
index 00000000000..747de272935
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/loop-unswitch-10.c
@@ -0,0 +1,28 @@
+/* { 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, float order)
+{
+ for (int i = 0; i < size; i++)
+ {
+ double tmp;
+
+ if (order == 1.f)
+ tmp = -8 * a[i];
+ else
+ tmp = -4 * b[i];
+
+ double x = 3 * tmp + d[i] + tmp;
+
+ if (order == 1.f)
+ x += 2;
+
+ double y = 3.4f * tmp + d[i];
+ r[i] = x + y;
+ }
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times ";; Unswitching loop with condition: order.* == 1.0e" 1 "unswitch" } } */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-11-08 15:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-08 15:36 [gcc(refs/users/marxin/heads/loop-unswitching-switch-v5)] Add new test-case 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).