From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 6B09A3858D20 for ; Wed, 9 Nov 2022 07:08:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6B09A3858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667977689; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SRf3fV+Eii5XPbwwOiqLMEwcZGdFMlGJ4XLqKlMIEEE=; b=g1cHpIevp23BZAdbfu01H+PfnvnKFtvhB807X/Ncv1ijt/rnXUmWdx4LL0//4vVv+VR2BW by/jyobHGYkcqsuwJmHDDVnYLWiC5qKwgNsdHl+3pMTFP8+MmfXR28OG4wP8BQSjkG9Dsu QfSs0aArSMVL6sXm5/hcSFQcsjhQrLI= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-131-VscCdXqFNe-g9EHYO6rOqA-1; Wed, 09 Nov 2022 02:08:07 -0500 X-MC-Unique: VscCdXqFNe-g9EHYO6rOqA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 16556886462 for ; Wed, 9 Nov 2022 07:08:07 +0000 (UTC) Received: from abulafia.quesejoda.com (unknown [10.39.192.190]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BC1A92166B29; Wed, 9 Nov 2022 07:08:06 +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 2A9784Vn1030653 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 9 Nov 2022 08:08:04 +0100 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.17.1/8.17.1/Submit) id 2A9784Qf1030652; Wed, 9 Nov 2022 08:08:04 +0100 From: Aldy Hernandez To: GCC patches Cc: Jakub Jelinek , Andrew MacLeod , Aldy Hernandez Subject: [COMMITTED] [range-op-float] Implement MINUS_EXPR. Date: Wed, 9 Nov 2022 08:07:58 +0100 Message-Id: <20221109070758.1030615-2-aldyh@redhat.com> In-Reply-To: <20221109070758.1030615-1-aldyh@redhat.com> References: <20221109070758.1030615-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.4 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 List-Id: Now that the generic parts of the binary operators have been abstracted, implementing MINUS_EXPR is a cinch. The op[12]_range entries will be submitted as a follow-up. gcc/ChangeLog: * range-op-float.cc (class foperator_minus): New. (floating_op_table::floating_op_table): Add MINUS_EXPR entry. --- gcc/range-op-float.cc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc index 7075c25442a..d52e971f84e 100644 --- a/gcc/range-op-float.cc +++ b/gcc/range-op-float.cc @@ -1884,6 +1884,29 @@ class foperator_plus : public range_operator_float } fop_plus; +class foperator_minus : public range_operator_float +{ + void rv_fold (REAL_VALUE_TYPE &lb, REAL_VALUE_TYPE &ub, bool &maybe_nan, + tree type, + const REAL_VALUE_TYPE &lh_lb, + const REAL_VALUE_TYPE &lh_ub, + const REAL_VALUE_TYPE &rh_lb, + const REAL_VALUE_TYPE &rh_ub) const final override + { + frange_arithmetic (MINUS_EXPR, type, lb, lh_lb, rh_ub, dconstninf); + frange_arithmetic (MINUS_EXPR, type, ub, lh_ub, rh_lb, dconstinf); + + // [+INF] - [+INF] = NAN + if (real_isinf (&lh_ub, false) && real_isinf (&rh_ub, false)) + maybe_nan = true; + // [-INF] - [-INF] = NAN + else if (real_isinf (&lh_lb, true) && real_isinf (&rh_lb, true)) + maybe_nan = true; + else + maybe_nan = false; + } +} fop_minus; + // Instantiate a range_op_table for floating point operations. static floating_op_table global_floating_table; @@ -1917,6 +1940,7 @@ floating_op_table::floating_op_table () set (ABS_EXPR, fop_abs); set (NEGATE_EXPR, fop_negate); set (PLUS_EXPR, fop_plus); + set (MINUS_EXPR, fop_minus); } // Return a pointer to the range_operator_float instance, if there is -- 2.38.1