public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Martin Liska <marxin@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/marxin/heads/loop-unswitch-improvement)] Add new test. Date: Mon, 22 Nov 2021 12:45:03 +0000 (GMT) [thread overview] Message-ID: <20211122124503.68FBA385801B@sourceware.org> (raw) 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" } } */
next reply other threads:[~2021-11-22 12:45 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-11-22 12:45 Martin Liska [this message] -- strict thread matches above, loose matches on Subject: below -- 2021-11-19 14:34 Martin Liska 2021-11-19 13:53 Martin Liska
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20211122124503.68FBA385801B@sourceware.org \ --to=marxin@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).