From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id B571C388A43D for ; Tue, 11 May 2021 12:40:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B571C388A43D Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 14BCY8Qu076515 for ; Tue, 11 May 2021 08:40:34 -0400 Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com with ESMTP id 38fqrf4kmc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 11 May 2021 08:40:34 -0400 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 14BCSLj9002397 for ; Tue, 11 May 2021 12:40:32 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma06ams.nl.ibm.com with ESMTP id 38dhwh9p1b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 11 May 2021 12:40:32 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 14BCe2lo21102976 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 May 2021 12:40:02 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3FA4DA405C; Tue, 11 May 2021 12:40:29 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1632DA4062; Tue, 11 May 2021 12:40:29 +0000 (GMT) Received: from li-23497a81-5215-11cb-9bae-a81330ecc14b.ibm.com (unknown [9.171.78.184]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 11 May 2021 12:40:28 +0000 (GMT) Subject: Re: [PATCH] s390: Add more vcond_mask patterns. To: Robin Dapp , GCC Patches References: <49d520d8-c771-66bd-e657-d02d2990cb0a@linux.ibm.com> From: Andreas Krebbel Message-ID: <3ad02016-2027-a15c-28b1-4c723e8ede23@linux.ibm.com> Date: Tue, 11 May 2021 14:40:28 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <49d520d8-c771-66bd-e657-d02d2990cb0a@linux.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: It2WWurRGeslRXDnrA2RW0z1U-MRqSrY X-Proofpoint-GUID: It2WWurRGeslRXDnrA2RW0z1U-MRqSrY X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.761 definitions=2021-05-11_02:2021-05-11, 2021-05-11 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 adultscore=0 mlxlogscore=999 clxscore=1015 suspectscore=0 priorityscore=1501 bulkscore=0 phishscore=0 malwarescore=0 spamscore=0 impostorscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105110097 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, 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: Tue, 11 May 2021 12:40:37 -0000 Hi Robin, On 5/5/21 5:18 PM, Robin Dapp wrote: ... > diff --git a/gcc/config/s390/vector.md b/gcc/config/s390/vector.md > index c80d582a300..7c730432d80 100644 > --- a/gcc/config/s390/vector.md > +++ b/gcc/config/s390/vector.md > @@ -36,6 +36,7 @@ > (define_mode_iterator V_HW2 [V16QI V8HI V4SI V2DI V2DF (V4SF "TARGET_VXE") > (V1TF "TARGET_VXE") (TF "TARGET_VXE")]) > > + whitespace diff? > (define_mode_iterator V_HW_64 [V2DI V2DF]) > (define_mode_iterator VT_HW_HSDT [V8HI V4SI V4SF V2DI V2DF V1TI V1TF TI TF]) > (define_mode_iterator V_HW_HSD [V8HI V4SI (V4SF "TARGET_VXE") V2DI V2DF]) > @@ -725,6 +726,26 @@ > "TARGET_VX" > "operands[4] = CONST0_RTX (mode);") > > +(define_expand "vcond_mask_" > + [(set (match_operand:VX_VEC_CONV_BFP 0 "register_operand" "") > + (if_then_else:VX_VEC_CONV_BFP > + (eq (match_operand:VX_VEC_CONV_INT 3 "register_operand" "") > + (match_dup 4)) > + (match_operand:VX_VEC_CONV_BFP 2 "register_operand" "") > + (match_operand:VX_VEC_CONV_BFP 1 "register_operand" "")))] > + "TARGET_VX" > + "operands[4] = CONST0_RTX (mode);") This should be covered by the existing pattern already. > + > +(define_expand "vcond_mask_" > + [(set (match_operand:VX_VEC_CONV_INT 0 "register_operand" "") > + (if_then_else:VX_VEC_CONV_INT > + (eq (match_operand:VX_VEC_CONV_BFP 3 "register_operand" "") > + (match_dup 4)) > + (match_operand:VX_VEC_CONV_INT 2 "register_operand" "") > + (match_operand:VX_VEC_CONV_INT 1 "register_operand" "")))] > + "TARGET_VX" > + "operands[4] = CONST0_RTX (mode);") op3 is supposed to be a comparison result operand. A vector float mode looks wrong here. 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" "") > + > > ; We only have HW support for byte vectors. The middle-end is > ; supposed to lower the mode if required. > 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..8795d08a732 > --- /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 "-O3 -march=z14 -mzarch" } */ I think you have to add -fdump-tree-vect-details here. Otherwise the dump scan below will just go as "unresolved". > + > +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..1153cace420 > --- /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 "-O3 -march=z15 -mzarch" } */ Likewise. > + > +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 > Andreas