From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 38746 invoked by alias); 30 Sep 2019 14:50:31 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 38710 invoked by uid 89); 30 Sep 2019 14:50:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.3 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mx0b-001b2d01.pphosted.com Received: from mx0b-001b2d01.pphosted.com (HELO mx0b-001b2d01.pphosted.com) (148.163.158.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 30 Sep 2019 14:50:26 +0000 Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x8UEb0JT087473 for ; Mon, 30 Sep 2019 10:50:24 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2va2b60r3s-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 30 Sep 2019 10:50:22 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 30 Sep 2019 15:50:19 +0100 Received: from b06avi18878370.portsmouth.uk.ibm.com (9.149.26.194) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 30 Sep 2019 15:50:17 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x8UEoGKn39780792 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 30 Sep 2019 14:50:16 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0C634A4055; Mon, 30 Sep 2019 14:50:16 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D74D4A4059; Mon, 30 Sep 2019 14:50:15 +0000 (GMT) Received: from [9.152.222.55] (unknown [9.152.222.55]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 30 Sep 2019 14:50:15 +0000 (GMT) Subject: Re: [PATCH v3 7/9] S/390: Remove code duplication in vec_* comparison expanders To: Ilya Leoshkevich References: <20190905111019.8951-1-iii@linux.ibm.com> <20190905111019.8951-8-iii@linux.ibm.com> Cc: gcc-patches@gcc.gnu.org From: Andreas Krebbel Date: Mon, 30 Sep 2019 14:50:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190905111019.8951-8-iii@linux.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit x-cbid: 19093014-0020-0000-0000-0000037316F0 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19093014-0021-0000-0000-000021C8F1EE Message-Id: X-IsSubscribed: yes X-SW-Source: 2019-09/txt/msg01769.txt.bz2 On 05.09.19 13:10, Ilya Leoshkevich wrote: > s390.md uses a lot of near-identical expanders that perform dispatching > to other expanders based on operand types. Since the following patch > would require even more of these, avoid copy-pasting the code by > generating these expanders using an iterator. > > gcc/ChangeLog: > > 2019-08-09 Ilya Leoshkevich > > PR target/77918 > * config/s390/s390.c (s390_expand_vec_compare): Use > gen_vec_cmpordered and gen_vec_cmpunordered. > * config/s390/vector.md (vec_cmpuneq, vec_cmpltgt, vec_ordered, > vec_unordered): Delete. > (vec_ordered): Rename to vec_cmpordered. > (vec_unordered): Rename to vec_cmpunordered. > (vec_cmp): Generic dispatcher. VEC_CODE_WITH_COMPLEX_EXPAND is pretty long and doesn't mention that it is about compare operators. Perhaps VEC_CMP_EXPAND or something like this? Btw. could you please mention the new iterator in the changelog. Ok. Andreas > --- > gcc/config/s390/s390.c | 4 +-- > gcc/config/s390/vector.md | 67 +++++++-------------------------------- > 2 files changed, 13 insertions(+), 58 deletions(-) > > diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c > index 24784266848..f36e12affd2 100644 > --- a/gcc/config/s390/s390.c > +++ b/gcc/config/s390/s390.c > @@ -6523,10 +6523,10 @@ s390_expand_vec_compare (rtx target, enum rtx_code cond, > emit_insn (gen_vec_cmpltgt (target, cmp_op1, cmp_op2)); > return; > case ORDERED: > - emit_insn (gen_vec_ordered (target, cmp_op1, cmp_op2)); > + emit_insn (gen_vec_cmpordered (target, cmp_op1, cmp_op2)); > return; > case UNORDERED: > - emit_insn (gen_vec_unordered (target, cmp_op1, cmp_op2)); > + emit_insn (gen_vec_cmpunordered (target, cmp_op1, cmp_op2)); > return; > default: break; > } > diff --git a/gcc/config/s390/vector.md b/gcc/config/s390/vector.md > index 1b66b8be61f..a093ae5c565 100644 > --- a/gcc/config/s390/vector.md > +++ b/gcc/config/s390/vector.md > @@ -1507,22 +1507,6 @@ > operands[3] = gen_reg_rtx (mode); > }) > > -(define_expand "vec_cmpuneq" > - [(match_operand 0 "register_operand" "") > - (match_operand 1 "register_operand" "") > - (match_operand 2 "register_operand" "")] > - "TARGET_VX" > -{ > - if (GET_MODE (operands[1]) == V4SFmode) > - emit_insn (gen_vec_cmpuneqv4sf (operands[0], operands[1], operands[2])); > - else if (GET_MODE (operands[1]) == V2DFmode) > - emit_insn (gen_vec_cmpuneqv2df (operands[0], operands[1], operands[2])); > - else > - gcc_unreachable (); > - > - DONE; > -}) > - > ; LTGT a <> b -> a > b | b > a > (define_expand "vec_cmpltgt" > [(set (match_operand: 0 "register_operand" "=v") > @@ -1535,24 +1519,8 @@ > operands[3] = gen_reg_rtx (mode); > }) > > -(define_expand "vec_cmpltgt" > - [(match_operand 0 "register_operand" "") > - (match_operand 1 "register_operand" "") > - (match_operand 2 "register_operand" "")] > - "TARGET_VX" > -{ > - if (GET_MODE (operands[1]) == V4SFmode) > - emit_insn (gen_vec_cmpltgtv4sf (operands[0], operands[1], operands[2])); > - else if (GET_MODE (operands[1]) == V2DFmode) > - emit_insn (gen_vec_cmpltgtv2df (operands[0], operands[1], operands[2])); > - else > - gcc_unreachable (); > - > - DONE; > -}) > - > ; ORDERED (a, b): a >= b | b > a > -(define_expand "vec_ordered" > +(define_expand "vec_cmpordered" > [(set (match_operand: 0 "register_operand" "=v") > (ge: (match_operand:VFT 1 "register_operand" "v") > (match_operand:VFT 2 "register_operand" "v"))) > @@ -1563,45 +1531,32 @@ > operands[3] = gen_reg_rtx (mode); > }) > > -(define_expand "vec_ordered" > - [(match_operand 0 "register_operand" "") > - (match_operand 1 "register_operand" "") > - (match_operand 2 "register_operand" "")] > - "TARGET_VX" > -{ > - if (GET_MODE (operands[1]) == V4SFmode) > - emit_insn (gen_vec_orderedv4sf (operands[0], operands[1], operands[2])); > - else if (GET_MODE (operands[1]) == V2DFmode) > - emit_insn (gen_vec_orderedv2df (operands[0], operands[1], operands[2])); > - else > - gcc_unreachable (); > - > - DONE; > -}) > - > ; UNORDERED (a, b): !ORDERED (a, b) > -(define_expand "vec_unordered" > +(define_expand "vec_cmpunordered" > [(match_operand: 0 "register_operand" "=v") > (match_operand:VFT 1 "register_operand" "v") > (match_operand:VFT 2 "register_operand" "v")] > "TARGET_VX" > { > - emit_insn (gen_vec_ordered (operands[0], operands[1], operands[2])); > + emit_insn (gen_vec_cmpordered (operands[0], operands[1], operands[2])); > emit_insn (gen_rtx_SET (operands[0], > gen_rtx_NOT (mode, operands[0]))); > DONE; > }) > > -(define_expand "vec_unordered" > +(define_code_iterator VEC_CODE_WITH_COMPLEX_EXPAND > + [uneq ltgt ordered unordered]) > + > +(define_expand "vec_cmp" > [(match_operand 0 "register_operand" "") > - (match_operand 1 "register_operand" "") > - (match_operand 2 "register_operand" "")] > + (VEC_CODE_WITH_COMPLEX_EXPAND (match_operand 1 "register_operand" "") > + (match_operand 2 "register_operand" ""))] > "TARGET_VX" > { > if (GET_MODE (operands[1]) == V4SFmode) > - emit_insn (gen_vec_unorderedv4sf (operands[0], operands[1], operands[2])); > + emit_insn (gen_vec_cmpv4sf (operands[0], operands[1], operands[2])); > else if (GET_MODE (operands[1]) == V2DFmode) > - emit_insn (gen_vec_unorderedv2df (operands[0], operands[1], operands[2])); > + emit_insn (gen_vec_cmpv2df (operands[0], operands[1], operands[2])); > else > gcc_unreachable (); > >