From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1851) id E32883857C56; Fri, 19 Nov 2021 13:53:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E32883857C56 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Martin Liska To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/marxin/heads/loop-unswitch-improvement)] Add new test. X-Act-Checkin: gcc X-Git-Author: Martin Liska X-Git-Refname: refs/users/marxin/heads/loop-unswitch-improvement X-Git-Oldrev: 56df14f38381572da61568ab3bb550cf703455c0 X-Git-Newrev: 3702ed4e29a39953ce3f17e392d195575f4d30fe Message-Id: <20211119135354.E32883857C56@sourceware.org> Date: Fri, 19 Nov 2021 13:53:54 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Nov 2021 13:53:55 -0000 https://gcc.gnu.org/g:3702ed4e29a39953ce3f17e392d195575f4d30fe commit 3702ed4e29a39953ce3f17e392d195575f4d30fe Author: Martin Liska 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" } } */