From patchwork Thu Nov 24 09:15:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kewen.Lin" X-Patchwork-Id: 25398 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3282618wrr; Thu, 24 Nov 2022 01:20:50 -0800 (PST) X-Google-Smtp-Source: AA0mqf57eC01FXYhs2MEm4YzRjJTIS/fA4JXHDkq01mxuNbIM4J/JIA5TenwRxvxc4gDslxVWZfC X-Received: by 2002:a17:906:8455:b0:7aa:97c7:2c04 with SMTP id e21-20020a170906845500b007aa97c72c04mr13345605ejy.191.1669281650153; Thu, 24 Nov 2022 01:20:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669281650; cv=none; d=google.com; s=arc-20160816; b=NM6XlZnawLPcjTwR0ipW73vFX0g4OIrIJ1ToAeva/+iu7C+L20dFVvy9XitLKcgIWR 3qGYDuLPiXYG1KUOpbZnoq3L9wRlSqbOm1+Pjm5MgIj88tdockij3FDRTunSk3kFPmc6 04jVPpcOLhUduNpFILxkt6CzRSjFt2XLAGje8KjNt4HtXz/ORQT1AYaSdaRVFWt4psKM A07bk4W5Tjv3ff9D8pzt3k9Ohdu52SNDo5/RpeYeCsMxgoR9vNpMPPWDZRexjgOtUv1g kFqNX5aOiC1nGcjlapU9txguouXtL2Kk42iBQqh3qLXOciRNl665ROGfkU+EmvEbFHT3 9g9A== 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=az6JbKzX5PQheF3IFvPx9GBFNKXk4ANe1OtURBIzo90=; b=tls3OQSxq+9R26ELtekYYnK4eKl+hGLwev8qmoIx6lZAJSu/5xvClRkcuvTLcmBeoQ i8cExG0JxfenOHutj173KGSiuHEnpQ0zZObDvBKr7f+nUxG/knczM/e0mKsTaVmhkb02 mHc/D6Nf5d7aBOmd3iSi0Ll85SpVJPyXzn1m+03ZokiBctjKPKNyM72gbmYqPA3gBIUQ 861Ix1aqwNcyY4bFArinkdMThBrud3iVhTs6AbbJ2QUjd8/eAjV8hD2M4Al/0Rv53jqc 06R/VsgKEMcNGv9h0xpHQU6CzHyWIc9sCtlbVsq2UiV9ZAevIWOlgWxM1h+EfAoCSaJW xL0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="jvUM5/t6"; 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 mp14-20020a1709071b0e00b00781dbee4273si550531ejc.514.2022.11.24.01.20.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Nov 2022 01:20:50 -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="jvUM5/t6"; 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 449BC382FC85 for ; Thu, 24 Nov 2022 09:19:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 449BC382FC85 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669281595; bh=az6JbKzX5PQheF3IFvPx9GBFNKXk4ANe1OtURBIzo90=; 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=jvUM5/t62hv/lI7uGkoQOjiaW12VGoB3iaBp4dgg668I0TaUQxI5tGjwnFPd0BB36 N5ytX607Tiq/yDZokOsLaf61o93jrJjvFkWtvrtsFsDsoxqcMPnPv7qX9W9eJhw4IA JMwOEx940+xudjvJmgMQXN5mOYduJbXqSyHI1d9o= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id B7FA038425BA for ; Thu, 24 Nov 2022 09:16:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B7FA038425BA Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AO7WimY002749; Thu, 24 Nov 2022 09:16:58 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3m100tqku3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 24 Nov 2022 09:16:58 +0000 Received: from m0098416.ppops.net (m0098416.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 2AO8kIwE005664; Thu, 24 Nov 2022 09:16:57 GMT Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3m100tqktp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 24 Nov 2022 09:16:57 +0000 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 2AO95IID008387; Thu, 24 Nov 2022 09:16:55 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma04ams.nl.ibm.com with ESMTP id 3kxps8yw57-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 24 Nov 2022 09:16:55 +0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2AO9GqoT6619902 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 24 Nov 2022 09:16:52 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 304AB4204B; Thu, 24 Nov 2022 09:16:52 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 306B642045; Thu, 24 Nov 2022 09:16:51 +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:51 +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 2/9] rs6000: Rework vector float comparison in rs6000_emit_vector_compare - p2 Date: Thu, 24 Nov 2022 03:15:50 -0600 Message-Id: <20221124091557.514727-3-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: ZR5brlidjxTGMxVK4TkuH7ybhLQg_7Jx X-Proofpoint-ORIG-GUID: Gwo1kyFYzR0U8TLHO8Thiqggw1poU2LT 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 mlxscore=0 suspectscore=0 mlxlogscore=999 adultscore=0 lowpriorityscore=0 priorityscore=1501 impostorscore=0 spamscore=0 clxscore=1015 bulkscore=0 malwarescore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211240072 X-Spam-Status: No, score=-12.5 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?1750368675462397798?= X-GMAIL-MSGID: =?utf-8?q?1750368675462397798?= All kinds of vector float comparison operators have been supported in a rtl comparison pattern as vector.md, we can just emit an rtx comparison insn with the given comparison operator in function rs6000_emit_vector_compare instead of checking and handling the reverse condition cases. This is part 2, it further checks for comparison opeators NE/UNLE/UNLT. In rs6000_emit_vector_compare, they are handled with reversed code which is queried from function reverse_condition_maybe_unordered and inverting with one_cmpl_optab. It's the same as what we have in vector.md: ; ne(a,b) = ~eq(a,b) ; unle(a,b) = ~gt(a,b) ; unlt(a,b) = ~ge(a,b) The operators on the right side have been supported in part 1. This patch should not have any functionality change too. gcc/ChangeLog: * config/rs6000/rs6000.cc (rs6000_emit_vector_compare): Emit rtx comparison for operators NE/UNLE/UNLT of MODE_VECTOR_FLOAT directly. --- gcc/config/rs6000/rs6000.cc | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc index 5a8f7ff3bf8..09299bef6a2 100644 --- a/gcc/config/rs6000/rs6000.cc +++ b/gcc/config/rs6000/rs6000.cc @@ -15679,20 +15679,18 @@ rs6000_emit_vector_compare (enum rtx_code rcode, comparison operators in a comparison rtl pattern, we can just emit the comparison rtx insn directly here. Besides, we should have a centralized place to handle the possibility - of raising invalid exception. As the first step, only check - operators EQ/GT/GE/UNORDERED/ORDERED/LTGT/UNEQ for now, they - are handled equivalently as before. + of raising invalid exception. For EQ/GT/GE/UNORDERED/ + ORDERED/LTGT/UNEQ, they are handled equivalently as before; + for NE/UNLE/UNLT, they are handled with reversed code + and inverting, it's the same as before. FIXME: Handle the remaining vector float comparison operators here. */ if (GET_MODE_CLASS (dmode) == MODE_VECTOR_FLOAT - && (rcode == EQ - || rcode == GT - || rcode == GE - || rcode == UNORDERED - || rcode == ORDERED - || rcode == LTGT - || rcode == UNEQ)) + && rcode != LT + && rcode != LE + && rcode != UNGE + && rcode != UNGT) { mask = gen_reg_rtx (dmode); emit_insn (gen_rtx_SET (mask, gen_rtx_fmt_ee (rcode, dmode, op0, op1))); @@ -15720,8 +15718,6 @@ rs6000_emit_vector_compare (enum rtx_code rcode, try_again = true; break; case NE: - case UNLE: - case UNLT: case UNGE: case UNGT: /* Invert condition and try again.