From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id B863B39574CD for ; Wed, 9 Jun 2021 12:47:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B863B39574CD Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 159CY3Di063386 for ; Wed, 9 Jun 2021 08:47:21 -0400 Received: from ppma02fra.de.ibm.com (47.49.7a9f.ip4.static.sl-reverse.com [159.122.73.71]) by mx0b-001b2d01.pphosted.com with ESMTP id 392w5x9j6b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 09 Jun 2021 08:47:21 -0400 Received: from pps.filterd (ppma02fra.de.ibm.com [127.0.0.1]) by ppma02fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 159Cl4Vr002811 for ; Wed, 9 Jun 2021 12:47:19 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma02fra.de.ibm.com with ESMTP id 392e7988a6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 09 Jun 2021 12:47:19 +0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 159CkPX731588616 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 9 Jun 2021 12:46:25 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 986CE42041; Wed, 9 Jun 2021 12:47:16 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6F35E42045; Wed, 9 Jun 2021 12:47:16 +0000 (GMT) Received: from li-926bd7cc-2dd1-11b2-a85c-f6adc0f5efec.ibm.com (unknown [9.171.81.47]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Wed, 9 Jun 2021 12:47:16 +0000 (GMT) Subject: Re: [PATCH] s390: Add more vcond_mask patterns. To: Andreas Krebbel , GCC Patches References: <49d520d8-c771-66bd-e657-d02d2990cb0a@linux.ibm.com> <3ad02016-2027-a15c-28b1-4c723e8ede23@linux.ibm.com> From: Robin Dapp Message-ID: Date: Wed, 9 Jun 2021 14:47:16 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ad02016-2027-a15c-28b1-4c723e8ede23@linux.ibm.com> Content-Type: multipart/mixed; boundary="------------739380E005B90B49532198B6" Content-Language: en-US X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 2Mju633ViLfsn1UGu6P1QU09AV3D7a2A X-Proofpoint-GUID: 2Mju633ViLfsn1UGu6P1QU09AV3D7a2A X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.761 definitions=2021-06-09_04:2021-06-04, 2021-06-09 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 suspectscore=0 malwarescore=0 phishscore=0 spamscore=0 lowpriorityscore=0 mlxlogscore=999 priorityscore=1501 mlxscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106090061 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Jun 2021 12:47:23 -0000 This is a multi-part message in MIME format. --------------739380E005B90B49532198B6 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit > I think the real problem is the expander name. That's why it could not be found by optab. The second > mode needs to be the int vector mode of op3. With that change the testcases work as expected: > > diff --git a/gcc/config/s390/vector.md b/gcc/config/s390/vector.md > index c80d582a300d..ab605b3d2cf3 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" "") Ah, yes, it's indeed much simpler that way. Attached the revised version with the small change and the new tests as a single patch now. Regtest and bootstrap was successful. Regards Robin --------------739380E005B90B49532198B6 Content-Type: text/x-patch; charset=UTF-8; name="0001-s390-Add-more-vcond_mask-patterns.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-s390-Add-more-vcond_mask-patterns.patch" >From 790feb49a6494c33f0fd4386a8148e0a4880e33b Mon Sep 17 00:00:00 2001 From: Robin Dapp Date: Tue, 8 Jun 2021 11:49:26 +0200 Subject: [PATCH] s390: Add more vcond_mask patterns. Add vcond_mask patterns that allow another mode for the condition/mask than the source and target so e.g. boolean conditions become possible: vtarget = bool_cond ? vsource1 : vsource2. --- gcc/config/s390/vector.md | 2 +- .../s390/vector/vcond-mixed-double.c | 41 +++++++++++++++++++ .../s390/vector/vcond-mixed-float.c | 41 +++++++++++++++++++ 3 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/s390/vector/vcond-mixed-double.c create mode 100644 gcc/testsuite/gcc.target/s390/vector/vcond-mixed-float.c 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" } } */ -- 2.23.0 --------------739380E005B90B49532198B6--