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-unswitching-switch-v3)] Update tests.
Date: Mon, 13 Sep 2021 13:27:14 +0000 (GMT)	[thread overview]
Message-ID: <20210913132714.0C9B3385842F@sourceware.org> (raw)

https://gcc.gnu.org/g:a340739c27c12ca41e30f7f4c9d346346f4a1e14

commit a340739c27c12ca41e30f7f4c9d346346f4a1e14
Author: Martin Liska <mliska@suse.cz>
Date:   Mon Sep 13 15:04:32 2021 +0200

    Update tests.

Diff:
---
 gcc/testsuite/gcc.dg/loop-unswitch-9.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/loop-unswitch-9.c b/gcc/testsuite/gcc.dg/loop-unswitch-9.c
index 28b6e9669d5..3058d4a5b38 100644
--- a/gcc/testsuite/gcc.dg/loop-unswitch-9.c
+++ b/gcc/testsuite/gcc.dg/loop-unswitch-9.c
@@ -2,20 +2,25 @@
 /* { 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)
+foo(double *a, double *b, double *c, double *d, double *r, int size, unsigned order)
 {
   for (int i = 0; i < size; i++)
   {
     double tmp;
 
-    if (order < 5)
-      tmp = -8 * a[i];
-    else
-      tmp = -4 * b[i];
+    switch (order)
+      {
+      case 0 ... 4:
+	tmp = -8 * a[i];
+	break;
+      default:
+	tmp = -4 * b[i];
+	break;
+      }
 
     double x = 3 * tmp + d[i] + tmp;
 
-    /* This should not be unswitched as it's mutually excluded with order < 5.  */
+    /* This should not be unswitched as it's mutually excluded with case 0 ... 4.  */
     if (order >= 5)
       x += 2;
 
@@ -26,4 +31,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" 1 "unswitch" } } */
+/* { dg-final { scan-tree-dump-times ";; Unswitching loop with condition: order.* <= 4" 1 "unswitch" } } */


             reply	other threads:[~2021-09-13 13:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-13 13:27 Martin Liska [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-09-13 15:31 Martin Liska
2021-09-13 15:30 Martin Liska
2021-09-13 13:27 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=20210913132714.0C9B3385842F@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: link
Be 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).