From patchwork Wed Nov 16 06:48:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kewen.Lin" X-Patchwork-Id: 20736 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp3125165wru; Tue, 15 Nov 2022 22:49:22 -0800 (PST) X-Google-Smtp-Source: AA0mqf5hY+zz9DgLj+dhv+eCoOcaGxrXuwlBm2BVM+2GZGzwhMesQgO90d+KxWahLjjBBZ7iHemG X-Received: by 2002:a17:907:9142:b0:78d:9c18:7307 with SMTP id l2-20020a170907914200b0078d9c187307mr18253792ejs.23.1668581362694; Tue, 15 Nov 2022 22:49:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668581362; cv=none; d=google.com; s=arc-20160816; b=yMEzk6646/sKakc1/moYeEWPubUX9ZjzLoZ3ZTZ4P6Tp4FrroSykqv3OZO2CtCWLMQ nIYZHt/hQueSab5lTzEIlvmbl0jmKbFm5twGClzoxpF14jp910GB+MvP7LIJmTU7QKfT VPrKUdcNd0xr3T77Wj+kW5xbnGtEZrNoJNtMahaZAbiVTgrD+MHAiYswxRQBW7j7l+Uj rNi6ndWJOIUjLkk2Agq1//pvPHaWfopPnb4vrMKZHQjhPzJ6cY1lBbc4cschUQGvqd2t uh9Dq+9bTFp0x3S7sAyZvQd+Mb+S33s/77ko+kExB3XBeKtz3YZ+k6nBeyvVQTsR1TIo U+yQ== 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:cc:to:subject:content-language:user-agent :mime-version:date:message-id:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=qayZK5jaKAbiTSsGEMyaLgOIvnrAo3/bKiOeUkZUKcU=; b=yr4E4G36z7SUQ7vfWk2cRIeaXAsU3ICv+P4tB4RsVqgYD2wFlbZKDu1cRqzhDvxuFn UOBNuYiStZmKc/DQHvdHPaSs4OQ3LgRucJpb7U6V06EMAxujJJQB9bfCdhZlsny62qgz MplikfFB+0MJx1uuHmwdRVvamL+2ukvWibHYc6NCFYy/rO5W3oFH3IS2Q+XaFEQHEVQA EF/29A6+lbJ+S11kaH6mntqb6vVHd0zvfOe48mqkbYc0CfPFXNIGCEu6tj5v/7Zw5ESC LUfqT/97O73Yg4ool8rOd+6F4vN6CoGyIGYXp9GMIoBwY5z3CWX4t8ogZ62xpuSScO5Z 8lRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=iQqCJKbh; 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 r22-20020aa7c156000000b004615ccd71a0si12176254edp.162.2022.11.15.22.49.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Nov 2022 22:49:22 -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=iQqCJKbh; 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 1E1093954C6E for ; Wed, 16 Nov 2022 06:49:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1E1093954C6E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668581361; bh=qayZK5jaKAbiTSsGEMyaLgOIvnrAo3/bKiOeUkZUKcU=; h=Date:Subject:To:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=iQqCJKbhT+IuJGlwJwMLPv/HsUS9BtzcN+2st6bgw5CZZgjY46zMghyDMX+ol2F6e LtV4GQo33ggVECV3uOB00tNEs3ThOBjL2J4O00ZH/+Bu3V2Cpm4ohh6LfxEJC8e7vt 1ji8WIybV+rvOlCthxoPWU84UUvSj91vnBkZmCCE= 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 B4F8C3954C63 for ; Wed, 16 Nov 2022 06:48:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B4F8C3954C63 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 2AG4WIDa008562; Wed, 16 Nov 2022 06:48:35 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3kvnv9e89k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Nov 2022 06:48:35 +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 2AG6kOO9000306; Wed, 16 Nov 2022 06:48:34 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 3kvnv9e891-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Nov 2022 06:48:34 +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 2AG6Zpxc007594; Wed, 16 Nov 2022 06:48:32 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma04ams.nl.ibm.com with ESMTP id 3kt348we0q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Nov 2022 06:48:32 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2AG6mS3x5898912 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 16 Nov 2022 06:48:28 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CDA704C040; Wed, 16 Nov 2022 06:48:28 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DBCAC4C044; Wed, 16 Nov 2022 06:48:26 +0000 (GMT) Received: from [9.197.233.36] (unknown [9.197.233.36]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 16 Nov 2022 06:48:26 +0000 (GMT) Message-ID: Date: Wed, 16 Nov 2022 14:48:25 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Content-Language: en-US Subject: [PATCH 1/2] rs6000: Emit vector fp comparison directly in rs6000_emit_vector_compare To: GCC Patches Cc: Segher Boessenkool , David Edelsohn , Peter Bergner , Michael Meissner X-TM-AS-GCONF: 00 X-Proofpoint-GUID: ZHUM9Wm41DPQ3ER_Wjs4J35SEQmGJ-bk X-Proofpoint-ORIG-GUID: MM0xQNkROM4Qvz08HP0QPiY1yYZV_dMS 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-15_08,2022-11-15_03,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 mlxlogscore=999 clxscore=1015 malwarescore=0 adultscore=0 impostorscore=0 phishscore=0 lowpriorityscore=0 mlxscore=0 priorityscore=1501 suspectscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211160046 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, 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?1749634370721339347?= X-GMAIL-MSGID: =?utf-8?q?1749634370721339347?= Hi, All kinds of vector float comparison operators have been supported in one 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 also for a subsequent patch to deal with some comparison operators under trapping math enabled or disabled, so it's important to have one centralized place for vector float comparison handlings for better maintenance. Bootstrapped and regtested on powerpc64-linux-gnu P7 and P8, and powerpc64le-linux-gnu P9 and P10. I'm going to push this later this week if no objections. BR, Kewen ----- gcc/ChangeLog: * config/rs6000/rs6000.cc (rs6000_emit_vector_compare_inner): Remove float only comparison operators. (rs6000_emit_vector_compare): Emit vector comparison insn directly for float modes. --- gcc/config/rs6000/rs6000.cc | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) -- 2.27.0 diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc index 635aced6105..56db12f08a0 100644 --- a/gcc/config/rs6000/rs6000.cc +++ b/gcc/config/rs6000/rs6000.cc @@ -15660,10 +15660,6 @@ rs6000_emit_vector_compare_inner (enum rtx_code code, rtx op0, rtx op1) case EQ: case GT: case GTU: - case ORDERED: - case UNORDERED: - case UNEQ: - case LTGT: mask = gen_reg_rtx (mode); emit_insn (gen_rtx_SET (mask, gen_rtx_fmt_ee (code, mode, op0, op1))); return mask; @@ -15681,12 +15677,24 @@ rs6000_emit_vector_compare (enum rtx_code rcode, machine_mode dmode) { rtx mask; - bool swap_operands = false; - bool try_again = false; - gcc_assert (VECTOR_UNIT_ALTIVEC_OR_VSX_P (dmode)); gcc_assert (GET_MODE (op0) == GET_MODE (op1)); + /* In vector.md, we support all kinds of vector float point + 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. */ + if (GET_MODE_CLASS (dmode) == MODE_VECTOR_FLOAT) + { + 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; + /* See if the comparison works as is. */ mask = rs6000_emit_vector_compare_inner (rcode, op0, op1); if (mask) @@ -15705,10 +15713,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. e.g., A != B becomes ~(A==B). */ {