From patchwork Thu Nov 24 09:15:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kewen.Lin" X-Patchwork-Id: 25401 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3283139wrr; Thu, 24 Nov 2022 01:22:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf6OQQNQucwtT5cmzy06Icgc8LbhkVGRTnMqqXvls6iec01cr8ZuJ8Y+y4qA7hqacMCMRBUH X-Received: by 2002:a17:907:7e94:b0:7ba:e547:4d83 with SMTP id qb20-20020a1709077e9400b007bae5474d83mr2852109ejc.163.1669281748441; Thu, 24 Nov 2022 01:22:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669281748; cv=none; d=google.com; s=arc-20160816; b=sikBI5qx+s+DhQwuVYefMvLey6eeFKZZAJJ4h5acfXU1bm1q6cjhxV9n5b1c1GAZFk UU9YotAEZXxqAUMuUvX5fkdtGihnXdhD1xzOPp1LihC8JCRJZjtxLDglJK7d/BlifToX ETIhKFTUx9uoR/7sl5zNi3BidanPhGfzLhh75PeS6iB2TQYmoaa0PueFK1IlUjbkjJ21 tYoz62QuTGKkNx1xzbv6bUo0kUeYY2f5vM/4LGIbCjy7TIEMrx5TJIENMMDI66ekufL6 vAZKR4JLLqX4Kjf2b2xgelutZhU8ns/0g0sfYhuehirU3DEOWWw+e5pB8X4iSHCsWvDM Ng8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=1+agegWTa5CTeOXgA6CnJPKsD02XCnDCzmuqy604vgQ=; b=DlVI8ptwGhp38wGREEL1/x2EPWyfEB563naatoqwpQPutP/J9OQWRl2mq9AYhIIt7G vDZTQKLxNMb4C45oO/crzRTsvCHQJOw3nDRI1bmSkR1HGvoDCysyzLcmnIo9vOKUIMol gRJaiNFRd1EG76XV6/dYk7uSCN09/uSk+cqjw7h0+BFi+J6i1Gxs0XJI+TLfk/bWdNVr mPa1jF4tF8gE3Uz7aPlM1ig79VlqIlzMuqF3tD2L89uwztieMDOhf2EpzR/3xvhkzb0T zd1C7Q47VEmP92poNzBVHcf5sv+c/hh4oiVeBVuVflmI3Ls01IdZv0JnO75kYcDt6GmX x0gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=n2WCQ7jg; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id ck17-20020a170906c45100b007418e87eea8si199000ejb.770.2022.11.24.01.22.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Nov 2022 01:22:28 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=n2WCQ7jg; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C31C43832374 for ; Thu, 24 Nov 2022 09:21:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C31C43832374 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669281715; bh=1+agegWTa5CTeOXgA6CnJPKsD02XCnDCzmuqy604vgQ=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=n2WCQ7jg0dNpA0YsQfkB6WRp0M//D2NxIkJRKuGKdCdCG2rjJwP8miZyOses43/YY eM3qk4FEAHVuJifk7gQQ0uSpJtj9aKj1xQwh73rRoCGDcGJEkv3VeAWjFaDn+jrDqP 0wkEh+8W4jATIPURDAO0bNlzIHUKKGrNHclA94cw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id A01F138425B3 for ; Thu, 24 Nov 2022 09:17:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A01F138425B3 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AO7LAKY003213; Thu, 24 Nov 2022 09:17:05 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3m0y4xjhsw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 24 Nov 2022 09:17:05 +0000 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 2AO8HLsO006922; Thu, 24 Nov 2022 09:17:05 GMT Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3m0y4xjhsb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 24 Nov 2022 09:17:05 +0000 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 2AO95PmA026415; Thu, 24 Nov 2022 09:17:02 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma06ams.nl.ibm.com with ESMTP id 3kxpdhyx5b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 24 Nov 2022 09:17:02 +0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2AO9GxQT24511114 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 24 Nov 2022 09:16:59 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 66F4F42045; Thu, 24 Nov 2022 09:16:59 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6652D4203F; Thu, 24 Nov 2022 09:16:58 +0000 (GMT) Received: from trout.aus.stglabs.ibm.com (unknown [9.40.194.100]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 24 Nov 2022 09:16:58 +0000 (GMT) To: gcc-patches@gcc.gnu.org Cc: Kewen Lin , segher@kernel.crashing.org, dje.gcc@gmail.com, bergner@linux.ibm.com, meissner@linux.ibm.com Subject: [PATCH 5/9] rs6000: Rework vector integer comparison in rs6000_emit_vector_compare - p1 Date: Thu, 24 Nov 2022 03:15:53 -0600 Message-Id: <20221124091557.514727-6-linkw@linux.ibm.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20221124091557.514727-1-linkw@linux.ibm.com> References: <20221124091557.514727-1-linkw@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: ck5cMGeg7nQdL-LX4jg7NOtD8sG9Z_Pw X-Proofpoint-ORIG-GUID: nBWeT86z-EqUMBArUkgMFN2Dd3dd3wxl X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-24_05,2022-11-23_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxlogscore=999 phishscore=0 lowpriorityscore=0 spamscore=0 bulkscore=0 mlxscore=0 adultscore=0 malwarescore=0 impostorscore=0 suspectscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211240072 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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-Patchwork-Original-From: Kewen Lin via Gcc-patches From: "Kewen.Lin" Reply-To: Kewen Lin Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750368778385060327?= X-GMAIL-MSGID: =?utf-8?q?1750368778385060327?= The current handlings in rs6000_emit_vector_compare is a bit complicated to me, especially after we emit vector float comparison insn with the given code directly. So it's better to refactor the handlings of vector integer comparison here. This is part 1, it's to remove the helper function rs6000_emit_vector_compare_inner and move the logics into rs6000_emit_vector_compare. This patch doesn't introduce any functionality change. gcc/ChangeLog: * config/rs6000/rs6000.cc (rs6000_emit_vector_compare_inner): Remove. (rs6000_emit_vector_compare): Emit rtx comparison for operators EQ/ GT/GTU directly. --- gcc/config/rs6000/rs6000.cc | 37 +++++++++---------------------------- 1 file changed, 9 insertions(+), 28 deletions(-) diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc index 94e039649f5..0a5826800c5 100644 --- a/gcc/config/rs6000/rs6000.cc +++ b/gcc/config/rs6000/rs6000.cc @@ -15639,30 +15639,6 @@ output_cbranch (rtx op, const char *label, int reversed, rtx_insn *insn) return string; } -/* Return insn for VSX or Altivec comparisons. */ - -static rtx -rs6000_emit_vector_compare_inner (enum rtx_code code, rtx op0, rtx op1) -{ - machine_mode mode = GET_MODE (op0); - gcc_assert (GET_MODE_CLASS (mode) != MODE_VECTOR_FLOAT); - - switch (code) - { - default: - break; - - case EQ: - case GT: - case GTU: - rtx mask = gen_reg_rtx (mode); - emit_insn (gen_rtx_SET (mask, gen_rtx_fmt_ee (code, mode, op0, op1))); - return mask; - } - - return NULL_RTX; -} - /* Emit vector compare for operands OP0 and OP1 using code RCODE. DMODE is expected destination mode. This is a recursive function. */ @@ -15687,10 +15663,15 @@ rs6000_emit_vector_compare (enum rtx_code rcode, return mask; } - /* See if the comparison works as is. */ - mask = rs6000_emit_vector_compare_inner (rcode, op0, op1); - if (mask) - return mask; + /* For any of vector integer comparison operators for which we + have direct hardware instructions, just emit it directly + here. */ + if (rcode == EQ || rcode == GT || rcode == GTU) + { + mask = gen_reg_rtx (dmode); + emit_insn (gen_rtx_SET (mask, gen_rtx_fmt_ee (rcode, dmode, op0, op1))); + return mask; + } bool swap_operands = false; bool try_again = false;