From patchwork Thu Oct 20 19:42:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 6364 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp291562wrr; Thu, 20 Oct 2022 12:43:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5D3m7SH/X19EBtLJP8VHfY/1xklQCPl73tktagTPnvdCViDknm8eTAMDoM4FCRMsExEM4w X-Received: by 2002:a05:6402:169a:b0:458:fe61:d3b4 with SMTP id a26-20020a056402169a00b00458fe61d3b4mr13461602edv.140.1666295006602; Thu, 20 Oct 2022 12:43:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666295006; cv=none; d=google.com; s=arc-20160816; b=pr6cJ3QQEX6bdA0ksNmCrGB8Oz+lQY56izkbqJKWlUUSwY3i01P1+k9TOuCvDuep3L oFXbo3FUMKeGpbphYP4LUZP2YrR7Yst4nBFZqOJr4GMsVyBmggc0rySXqvcTCT236hsu rkRb8Wt2GaQoBsIrWwwBADXODO4XeqjrvRHaXWZ0RDv6SjieWH82M0xHWhHi5LH9ojW1 aVo7f5aA/SSllc0TVWwRjxwuSjn2dKpUs34FxTYpgQ7xSzZY2ukR+G8iNrGvxmGAnXIX yyy2tVhch7DH1CXAWbXmoHeqs4dI4HDgItcmvtlrxnbDwecWs6kM7+dugMKoqwIAa/my WMGA== 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:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=zBK56ajLvLMhvlg+MFOL738ZL9V3AsgImEdSlIL7KlY=; b=Upy3lTgxG14NXEJxVmUTFRhhFf29T/jmKTUIz+O9DbfMAdzx3+qaOmTMj8t4uO8Rts NtwYSXFKbOQjWZb0nCeYLDGmY/22Fcu97j7E281T4d4HDp2YQOV5fxNBK0En1dnHDog2 8x2HMyi5eJiHjPBLngzgdoc27S5p3ATlfP8zRZISuO8AhID0ZW+Y/998sEvvcPm6aTAy O5yCY1GTl7w1AAxDpQEYi6mHhKkEgBBDoqDLiugSfpqlS1GX6Y2ckR0DOKHO7JeG1eAa MX+1Dg/Wo/DAeqT3EQe8NLW5FrvWhycxliN5OEKDBJGYToRx0aT5UIDQV8gROJ0z7/gx hKEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=wAzhe0SC; 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 e18-20020a50a692000000b004511944f801si16676528edc.270.2022.10.20.12.43.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 12:43:26 -0700 (PDT) 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=wAzhe0SC; 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 69961384C003 for ; Thu, 20 Oct 2022 19:43:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 69961384C003 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666295005; bh=zBK56ajLvLMhvlg+MFOL738ZL9V3AsgImEdSlIL7KlY=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=wAzhe0SCXEq+lRcE3NRGFaMacGLKjBzJB/hi93gP+Cnb4uxpC/1Yk+ofPUwmjLn7W LSzt4xdWDoxaRKmTdPIgNitY7er4W1Gudv+jHP1m4gE3mPsP+3aHbr3b4wnfh9vK41 0DPw9be9Owp5oP0595kJDXJp8YbGsF4qZyF8tzZY= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 087E7384D17B for ; Thu, 20 Oct 2022 19:42:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 087E7384D17B Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-213-Qc00lszZObq6p0DWzCzfWQ-1; Thu, 20 Oct 2022 15:42:35 -0400 X-MC-Unique: Qc00lszZObq6p0DWzCzfWQ-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1B6E31C05ACD for ; Thu, 20 Oct 2022 19:42:31 +0000 (UTC) Received: from abulafia.quesejoda.com (unknown [10.39.192.6]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B86DE49BB63; Thu, 20 Oct 2022 19:42:30 +0000 (UTC) Received: from abulafia.quesejoda.com (localhost [127.0.0.1]) by abulafia.quesejoda.com (8.17.1/8.17.1) with ESMTPS id 29KJgPTc259910 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 20 Oct 2022 21:42:25 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.17.1/8.17.1/Submit) id 29KJgPYk259909; Thu, 20 Oct 2022 21:42:25 +0200 To: GCC patches Subject: [COMMITTED] Add op[12]_range for UNORDERED_LT entries in range-op. Date: Thu, 20 Oct 2022 21:42:22 +0200 Message-Id: <20221020194222.259811-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, 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: Aldy Hernandez via Gcc-patches From: Aldy Hernandez Reply-To: Aldy Hernandez 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?1747236952841360212?= X-GMAIL-MSGID: =?utf-8?q?1747236952841360212?= In auditing the UNORDERED range-op code I noticed the UNLT_EXPR entry was missing op1_range and op2_range operators. That is, we were missing the ability to unwind back through an UNLT_EXPR. gcc/ChangeLog: * range-op-float.cc (foperator_unordered_lt::op1_range): New. (foperator_unordered_lt::op2_range): New. --- gcc/range-op-float.cc | 64 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc index 0cb07c2ec29..8777bc70d71 100644 --- a/gcc/range-op-float.cc +++ b/gcc/range-op-float.cc @@ -1280,6 +1280,8 @@ foperator_abs::op1_range (frange &r, tree type, class foperator_unordered_lt : public range_operator_float { using range_operator_float::fold_range; + using range_operator_float::op1_range; + using range_operator_float::op2_range; public: bool fold_range (irange &r, tree type, const frange &op1, const frange &op2, @@ -1302,8 +1304,70 @@ public: return true; } } + bool op1_range (frange &r, tree type, + const irange &lhs, + const frange &op2, + relation_trio trio) const final override; + bool op2_range (frange &r, tree type, + const irange &lhs, + const frange &op1, + relation_trio trio) const final override; } fop_unordered_lt; +bool +foperator_unordered_lt::op1_range (frange &r, tree type, + const irange &lhs, + const frange &op2, + relation_trio) const +{ + switch (get_bool_state (r, lhs, type)) + { + case BRS_TRUE: + build_lt (r, type, op2); + break; + + case BRS_FALSE: + // A false UNORDERED_LT means both operands are !NAN, so it's + // impossible for op2 to be a NAN. + if (op2.known_isnan ()) + r.set_undefined (); + else if (build_ge (r, type, op2)) + r.clear_nan (); + break; + + default: + break; + } + return true; +} + +bool +foperator_unordered_lt::op2_range (frange &r, tree type, + const irange &lhs, + const frange &op1, + relation_trio) const +{ + switch (get_bool_state (r, lhs, type)) + { + case BRS_TRUE: + build_gt (r, type, op1); + break; + + case BRS_FALSE: + // A false UNORDERED_LT means both operands are !NAN, so it's + // impossible for op1 to be a NAN. + if (op1.known_isnan ()) + r.set_undefined (); + else if (build_le (r, type, op1)) + r.clear_nan (); + break; + + default: + break; + } + return true; +} + class foperator_unordered_le : public range_operator_float { using range_operator_float::fold_range;