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 EC61E3858D37 for ; Tue, 21 Mar 2023 13:49:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EC61E3858D37 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=1679406594; 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=OfY1/cRdYRVD1txMvDuqJZDwS0++Dkwou2fmNfd8HQk=; b=dRJvxdZrO4k5XSgBhT83P1XRsAIrqWws2xUvCcocYcPjIXt79fu4zZ7OXJLX8CIQtiJMCI YDB+6umXXzEvnSIIZliCXz+uGQb5nyVQfQU3r+XkoZ5WcBEg0epUZ5CFNt+RZBAYHzEnbS 9NVZ3Y5hK3ssT9RmsQJgvhurt2LilWs= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-441-CfrhXpGeMi2xN_gM6ORsEg-1; Tue, 21 Mar 2023 09:49:52 -0400 X-MC-Unique: CfrhXpGeMi2xN_gM6ORsEg-1 Received: by mail-wm1-f71.google.com with SMTP id i3-20020a05600c354300b003edfa408811so2898249wmq.1 for ; Tue, 21 Mar 2023 06:49:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679406590; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=OfY1/cRdYRVD1txMvDuqJZDwS0++Dkwou2fmNfd8HQk=; b=XpbBySYuwSMb4U6+X+OJBiONoWtEyU7y+srxVhlI64LJxDXUYEyyDjUmxF4R+iZ9O+ F2fKQpZay3H/oZ3//Vtf1F2QSNLJ2l8tQbCJT2deW/ID8pTAP17gZlI2jG5kHrk+B3as cHQFVsdqpCCmHv9H3462g1iQllf4P5iklvztw7EmlOM9PTbrWECFQZYGDq294yCAEui9 jiU8JP0gUp7mTarqbhjrsye471jbVnqEBX8bUYFhf+BcRY3R1pgzqB33oyuQ61ZLbHQX rja8ZtR5A5EtJS9eGNrlxJC2uCbC/qn50A+SF6u0OIHT9zG2wOdTbGXYxGuXXyHcpaDg xgxA== X-Gm-Message-State: AO0yUKUbmhN2htW9Dh2re4AJQelgPdMr8IsAaIrH1UJRgJB+iQF7rBHV KczucL0ffz58FgfvbaHD444MRFQGvbRuAY1CPAUXAV8N8yGY9NxXGg463oIxOX7yQFN8g7x67e8 pPn3yEPiTPmYgh253+A== X-Received: by 2002:a7b:c409:0:b0:3e2:19b0:887d with SMTP id k9-20020a7bc409000000b003e219b0887dmr2347592wmi.25.1679406590658; Tue, 21 Mar 2023 06:49:50 -0700 (PDT) X-Google-Smtp-Source: AK7set+q6PsIE0/WA8Zo5/sXKXKum1wWGRrPddb/sg4TTn/XqAlmwwK9Bte2+WjULhZLcRKjpr174g== X-Received: by 2002:a7b:c409:0:b0:3e2:19b0:887d with SMTP id k9-20020a7bc409000000b003e219b0887dmr2347576wmi.25.1679406590338; Tue, 21 Mar 2023 06:49:50 -0700 (PDT) Received: from [192.168.1.201] ([139.47.42.170]) by smtp.gmail.com with ESMTPSA id ip24-20020a05600ca69800b003ede2c4701dsm7367113wmb.14.2023.03.21.06.49.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 21 Mar 2023 06:49:50 -0700 (PDT) Message-ID: Date: Tue, 21 Mar 2023 14:49:49 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH] range-op-float: Fix up -ffinite-math-only range extension and don't extend into infinities [PR109008] To: Jakub Jelinek Cc: Richard Biener , gcc-patches@gcc.gnu.org, Andrew MacLeod References: <1f0427e3-26f5-be76-4cab-5d8ec9ffb988@redhat.com> From: Aldy Hernandez In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_BARRACUDACENTRAL,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 3/21/23 14:39, Jakub Jelinek wrote: > On Tue, Mar 21, 2023 at 02:28:31PM +0100, Aldy Hernandez wrote: >>> /* Temporarily disable -ffinite-math-only, so that frange::set doesn't >>> reduce the range back to real_min_representable (type) as lower bound >>> or real_max_representable (type) as upper bound. */ >>> bool save_flag_finite_math_only = flag_finite_math_only; >>> flag_finite_math_only = false; >>> ret.set (type, lb, ub); >>> if (lhs.kind () != VR_VARYING) >>> { >>> ret.clear_nan (); >>> ret.union_ (lhs); >>> } >>> flag_finite_math_only = save_flag_finite_math_only; >> >> It looks like what you want to do is be able to create a range with a known >> NAN state, but without the setter reducing the range to >> min/max_representable. >> >> How about we enhance the API to provide: >> >> 1. Constructor with a known NAN state. >> 2. Setter with a flag to keep it from canonicalizing into >> min/max_representable. >> >> The flag in 2 could in the future be saved in the frange object to keep >> union and friends from further canonicalization. >> >> So the above could be written as: >> >> // Construct [lb, ub] with a known NAN state. >> frange tmp (lb, ub, lhs.get_nan_state ()); >> >> // Set RET without dropping/reducing the range to MIN/MAX. >> ret.set (tmp, FRANGE_FLAG_NO_REPRESENTABLE_REDUCTION); >> >> An alternative is to allow the setter to set everything: >> >> ret.set (type, lb, ub, >> lhs.get_nan_state (), >> FRANGE_FLAG_NO_REPRESENTABLE_REDUCTION); >> >> Would this work? I'd be happy to whip up something this week, or if >> preferred, leave it to the next release. > > The latter would be better, I really don't need a temporary range in that > spot, the union_ is only to copy the NaN state. > Though, I think right now set actually doesn't do reduction to representable > at all, all it does is equality compare bounds against the applicable > boundaries and if both are equal and NaN state is appropriate, change it > into VR_VARYING. > So maybe for now all we need is the 4 argument set. So, this? frange::set (tree type, const REAL_VALUE_TYPE &min, const REAL_VALUE_TYPE &max, const nan_state &, value_range_kind kind = VR_RANGE) If so, I'll start poking at it. Aldy