From patchwork Thu Nov 24 09:15:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kewen.Lin" X-Patchwork-Id: 25397 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3282430wrr; Thu, 24 Nov 2022 01:20:19 -0800 (PST) X-Google-Smtp-Source: AA0mqf5STGslmpVxoxSuPLdsFUM+klDdHg4hcDpeto6fVIrfykXf1WWX8p7MFpn20NrnCLKl27Yq X-Received: by 2002:a05:6402:512:b0:46a:6e7f:5f10 with SMTP id m18-20020a056402051200b0046a6e7f5f10mr3458830edv.152.1669281619365; Thu, 24 Nov 2022 01:20:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669281619; cv=none; d=google.com; s=arc-20160816; b=lgsG3Fb4cD85t8rVNC9RiSQfsjZoe7Py76yKhDv7XvohMQiy6ZP4EWZCsWVIYNnTqE 5ASArriCOf2za+0z44rCfQxv4BT178swi5bDKuIL+lPnt2fa81YTqHEvorJG+IOdKg7z 3yGWWI3goOs+b+I/yU05WbtFAgkrZyU9KSCz2fUbRMitZB+ts96nGdcYK7uExBt+eiXK 21akSKM/XoV2OtNj/QHbqOVy/dxSsLKLG7JPh9fHUSYGo58KnfmTyaydgCl3wb7UHbXd XeB9UTwar6AAhtIdfIdpsYWy/9zhY1V+t5zGhSI5GEAR9x1AH0UIPFVYxCna58XTv5vg /HVw== 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=/mKTPTeYxlZbDpKrgAKjLPH5b8pDaBipyZDPev8LVPM=; b=HoXLeGG2pwpCTqMX09G8ve19GMrXiKRTyMGmrYfivWOH8bPdcbq4alv50aB4tKFaXl 8ZkYJuFS1RC2594U3JfDDEe5OoUmc9YxYpuVa40lFWNebAwggP+2U9GylOkX4Je8Szhe O8I0XARyB1FFGdDd9s2CoCfqOXS/r6c3Wx1oyh8RBKyDkRigkNghHtQhRqXWagXg+7pG /SNK1+avac3gCoxzZRHd7ZfbjFI2GPUQRL99Y4Pd6sjolufUSqYaxF0jskZRMwUjrJLn EHJysxdEL0Vlyazjq5EN9cXiNNGvpc3ail42JavgIaAb8VlOuBpA8JisBmLZbKVl3HDw K1lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Xxxb56HN; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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. [8.43.85.97]) by mx.google.com with ESMTPS id 30-20020a17090600de00b007bb8667e804si275488eji.374.2022.11.24.01.20.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Nov 2022 01:20:19 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Xxxb56HN; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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 427B5383236B for ; Thu, 24 Nov 2022 09:19:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 427B5383236B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669281554; bh=/mKTPTeYxlZbDpKrgAKjLPH5b8pDaBipyZDPev8LVPM=; 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=Xxxb56HN2UcCTv104yjGncsS+7nWPONtvSKDR7DbY29FmX9hyUjvV0B2WlivOmEGv U0WxqYKVaW+yxgCsoGgQZAWLjvtL0S2LePA5tv3ST5djNSVGe7B9moC4sUFaoGfl/a 61q8qMf6k2IdvxoK4jsIcBwEJd0KNkYvSvMS8QLE= 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 3338A38432F8 for ; Thu, 24 Nov 2022 09:17:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3338A38432F8 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AO8qGkD014370; Thu, 24 Nov 2022 09:17:10 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3m10pgy6up-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 24 Nov 2022 09:17:10 +0000 Received: from m0098399.ppops.net (m0098399.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 2AO8oN0x016083; Thu, 24 Nov 2022 09:17:09 GMT Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3m10pgy6th-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 24 Nov 2022 09:17:09 +0000 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 2AO95CFN023719; Thu, 24 Nov 2022 09:17:07 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma04fra.de.ibm.com with ESMTP id 3kxps8wqjs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 24 Nov 2022 09:17:07 +0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2AO9H3mG66847104 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 24 Nov 2022 09:17:03 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D222242049; Thu, 24 Nov 2022 09:17:03 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D126A4203F; Thu, 24 Nov 2022 09:17:02 +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:17:02 +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 7/9] rs6000: Rework vector integer comparison in rs6000_emit_vector_compare - p3 Date: Thu, 24 Nov 2022 03:15:55 -0600 Message-Id: <20221124091557.514727-8-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-ORIG-GUID: wCMEgEiG8PjYLk8nqhbjjoeaHpz0pLDW X-Proofpoint-GUID: mI47Tr2Uklr_-RJsim2lAx77oJBJlHcE 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_06,2022-11-23_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 priorityscore=1501 adultscore=0 spamscore=0 phishscore=0 mlxscore=0 lowpriorityscore=0 bulkscore=0 malwarescore=0 clxscore=1015 impostorscore=0 mlxlogscore=961 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?1750368642883753748?= X-GMAIL-MSGID: =?utf-8?q?1750368642883753748?= 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 3, it's to refactor the handlings on NE. This patch doesn't introduce any functionality change. gcc/ChangeLog: * config/rs6000/rs6000.cc (rs6000_emit_vector_compare): Refactor the handlings for operator NE. --- gcc/config/rs6000/rs6000.cc | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc index c1aebbb5c03..b4ca7b3d1b1 100644 --- a/gcc/config/rs6000/rs6000.cc +++ b/gcc/config/rs6000/rs6000.cc @@ -15681,29 +15681,19 @@ rs6000_emit_vector_compare (enum rtx_code rcode, emit_insn (gen_rtx_SET (mask, gen_rtx_fmt_ee (code, dmode, op0, op1))); return mask; } + else if (rcode == NE) + { + /* ne(a,b) = ~eq(a,b) */ + mask = gen_reg_rtx (dmode); + emit_insn (gen_rtx_SET (mask, gen_rtx_fmt_ee (EQ, dmode, op0, op1))); + enum insn_code nor_code = optab_handler (one_cmpl_optab, dmode); + gcc_assert (nor_code != CODE_FOR_nothing); + emit_insn (GEN_FCN (nor_code) (mask, mask)); + return mask; + } switch (rcode) { - case NE: - /* Invert condition and try again. - e.g., A != B becomes ~(A==B). */ - { - enum insn_code nor_code; - rtx mask2; - - nor_code = optab_handler (one_cmpl_optab, dmode); - if (nor_code == CODE_FOR_nothing) - return NULL_RTX; - - mask2 = rs6000_emit_vector_compare (EQ, op0, op1, dmode); - if (!mask2) - return NULL_RTX; - - mask = gen_reg_rtx (dmode); - emit_insn (GEN_FCN (nor_code) (mask, mask2)); - return mask; - } - break; case GE: case GEU: case LE: