From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2017) id 7F9E83850428; Thu, 10 Jun 2021 12:20:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7F9E83850428 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Robin Dapp To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-1365] s390: Allow more vcond_mask patterns. X-Act-Checkin: gcc X-Git-Author: Robin Dapp X-Git-Refname: refs/heads/master X-Git-Oldrev: cbf6dcaac040b7a572b8287453101489637c626b X-Git-Newrev: 6961091b385c5c27c4a555aad0250d3390be05bf Message-Id: <20210610122009.7F9E83850428@sourceware.org> Date: Thu, 10 Jun 2021 12:20:09 +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: Thu, 10 Jun 2021 12:20:09 -0000 https://gcc.gnu.org/g:6961091b385c5c27c4a555aad0250d3390be05bf commit r12-1365-g6961091b385c5c27c4a555aad0250d3390be05bf Author: Robin Dapp Date: Thu Jun 10 14:18:28 2021 +0200 s390: Allow more vcond_mask patterns. Change vcond_mask iterator as to allow the corresponding int mode for the condition/mask so e.g. boolean conditions become possible: vtarget = bool_cond ? vsource1 : vsource2. gcc/ChangeLog: * config/s390/vector.md (vcond_mask_): Change to (vcond_mask_): this. gcc/testsuite/ChangeLog: * gcc.target/s390/vector/vcond-mixed-double.c: New test. * gcc.target/s390/vector/vcond-mixed-float.c: New test. Diff: --- gcc/config/s390/vector.md | 2 +- .../gcc.target/s390/vector/vcond-mixed-double.c | 41 ++++++++++++++++++++++ .../gcc.target/s390/vector/vcond-mixed-float.c | 41 ++++++++++++++++++++++ 3 files changed, 83 insertions(+), 1 deletion(-) diff --git a/gcc/config/s390/vector.md b/gcc/config/s390/vector.md index c80d582a300..ab605b3d2cf 100644 --- a/gcc/config/s390/vector.md +++ b/gcc/config/s390/vector.md @@ -715,7 +715,7 @@ DONE; }) -(define_expand "vcond_mask_" +(define_expand "vcond_mask_" [(set (match_operand:V 0 "register_operand" "") (if_then_else:V (eq (match_operand: 3 "register_operand" "") diff --git a/gcc/testsuite/gcc.target/s390/vector/vcond-mixed-double.c b/gcc/testsuite/gcc.target/s390/vector/vcond-mixed-double.c new file mode 100644 index 00000000000..015bc8ab473 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/vector/vcond-mixed-double.c @@ -0,0 +1,41 @@ +/* Check for vectorization of mixed conditionals. */ +/* { dg-do compile { target { s390*-*-* } } } */ +/* { dg-options "-O2 -march=z14 -mzarch -ftree-vectorize -fdump-tree-vect-details" } */ + +double xd[1024]; +double zd[1024]; +double wd[1024]; + +long xl[1024]; +long zl[1024]; +long wl[1024]; + +void foold () +{ + int i; + for (i = 0; i < 1024; ++i) + zd[i] = xl[i] ? zd[i] : wd[i]; +} + +void foodl () +{ + int i; + for (i = 0; i < 1024; ++i) + zl[i] = xd[i] ? zl[i] : wl[i]; +} + +void foold2 () +{ + int i; + for (i = 0; i < 1024; ++i) + zd[i] = (xd[i] > 0) ? zd[i] : wd[i]; +} + +void foold3 () +{ + int i; + for (i = 0; i < 1024; ++i) + zd[i] = (xd[i] > 0. & wd[i] < 0.) ? zd[i] : wd[i]; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 4 "vect" } } */ diff --git a/gcc/testsuite/gcc.target/s390/vector/vcond-mixed-float.c b/gcc/testsuite/gcc.target/s390/vector/vcond-mixed-float.c new file mode 100644 index 00000000000..ba40ffe8660 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/vector/vcond-mixed-float.c @@ -0,0 +1,41 @@ +/* Check for vectorization of mixed conditionals. */ +/* { dg-do compile { target { s390*-*-* } } } */ +/* { dg-options "-O2 -march=z14 -mzarch -ftree-vectorize -fdump-tree-vect-details" } */ + +float xf[1024]; +float zf[1024]; +float wf[1024]; + +int xi[1024]; +int zi[1024]; +int wi[1024]; + +void fooif () +{ + int i; + for (i = 0; i < 1024; ++i) + zf[i] = xi[i] ? zf[i] : wf[i]; +} + +void foofi () +{ + int i; + for (i = 0; i < 1024; ++i) + zi[i] = xf[i] ? zi[i] : wi[i]; +} + +void fooif2 () +{ + int i; + for (i = 0; i < 1024; ++i) + zf[i] = (xf[i] > 0) ? zf[i] : wf[i]; +} + +void fooif3 () +{ + int i; + for (i = 0; i < 1024; ++i) + zf[i] = (xf[i] > 0.f & wf[i] < 0.f) ? zf[i] : wf[i]; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 4 "vect" } } */