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 E258438582BC for ; Tue, 28 Mar 2023 08:49:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E258438582BC 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=1679993355; 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=LiBs5RiTMVZXWuhNL4ELyO+mnbyugPySv72C7ChFklQ=; b=i4M8U6BmuEP8H32nWR4/0qLSvF+7ZDwPN5+U/1crwjqCbb7hZvmhs2SqUi8KJGrETqN+q9 Sh9D+hU7lsCkt7KBuxQLtA1KPXGT7ebgnuACb0YqGwUvxWQ/+wePlcgh3FOTgCkqqt0JZT GfMby5+i8yNPp+BOMP1xqzR892aZafs= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-25-hIQjWPCENaSRpPgSZjpsCQ-1; Tue, 28 Mar 2023 04:49:14 -0400 X-MC-Unique: hIQjWPCENaSRpPgSZjpsCQ-1 Received: by mail-wm1-f69.google.com with SMTP id l18-20020a05600c1d1200b003ef7b61e2fdso27266wms.4 for ; Tue, 28 Mar 2023 01:49:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679993353; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=LiBs5RiTMVZXWuhNL4ELyO+mnbyugPySv72C7ChFklQ=; b=AnjSdCt3ixMDbOIOIv6XaNJPssyjo9L6jrAzFS+cegYYk6qVOBpyGGvKYQDqpoWgjI zQEM9wCJ8VnY4C4e4Up35CfIeMXw1Fs02GJZLsZAk9+Vn5ocy52CFJri7Q/7La3B0Ioz MgYFWS+HbtrXmPUUA7/R4+afsTMzxCF8wae/WSo5b8MbRGcr2bgXOmPaj5q4KWf0Yh2j DLUGzghmaEpphhN3g1jTYilnTUhZKQCeUavjxmI1BOq7VIptpeUTK0BpJRxOlHdpArMM fYPqrZYB2aJvHMJXLQGQsgGvfht+SsAR6gIJnG2xJf/iOjbBUnvLS4lDjj0AMaFhbiDP 9fcw== X-Gm-Message-State: AAQBX9c7XlpXrQ+T8mBN7jp9kgC15gtMoJPK1ENcWgwhow0MMcpudvVg G9mlHdpPofkugYyq6yJqejbBVzOEeejlJOMy0zwmMShLRumNjxx8DHBsN1K+qL/eXBJPZKqoVOK Xx8etcSWFlCCh2LjrXEYE1iJfLA== X-Received: by 2002:a1c:7918:0:b0:3ef:67fc:ff02 with SMTP id l24-20020a1c7918000000b003ef67fcff02mr7232322wme.7.1679993352960; Tue, 28 Mar 2023 01:49:12 -0700 (PDT) X-Google-Smtp-Source: AKy350a3jMfSUIxpjVp7HwkJx0odYx6GTgBNFM3GBT8l0Y4Tjs3lRs532+jKZLSjE5/9QIxwMcxIag== X-Received: by 2002:a1c:7918:0:b0:3ef:67fc:ff02 with SMTP id l24-20020a1c7918000000b003ef67fcff02mr7232306wme.7.1679993352622; Tue, 28 Mar 2023 01:49:12 -0700 (PDT) Received: from [192.168.1.201] ([139.47.42.170]) by smtp.gmail.com with ESMTPSA id k15-20020a7bc40f000000b003edc11c2ecbsm10509299wmi.4.2023.03.28.01.49.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 28 Mar 2023 01:49:12 -0700 (PDT) Message-ID: Date: Tue, 28 Mar 2023 10:49:11 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [RFC PATCH] range-op-float: Only flush_denormals_to_zero for +-*/ [PR109154] To: Jakub Jelinek , Andrew MacLeod Cc: gcc-patches@gcc.gnu.org References: 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/28/23 10:16, Jakub Jelinek wrote: > Hi! > > As discussed in the PR, flushing denormals to zero on every frange::set > might be harmful for e.g. x < 0.0 comparisons, because we then on both > sides use ranges that include zero [-Inf, -0.0] on the true side, and > [-0.0, +Inf] NAN on the false side, rather than [-Inf, nextafter (-0.0, -Inf)] > on the true side. > > The following patch does it only in range_operator_float::fold_range > which is right now used for +-*/ (both normal and reverse ops of those). > > Though, I don't see any difference on the testcase in the PR, but not sure > what I should be looking at and the reduced testcase there has undefined > behavior. > > Anyway, bootstrapped/regtested on x86_64-linux and i686-linux. LGTM. Aldy > > If it doesn't help with the PR, could be as well deferred for stage 1. > > 2023-03-28 Jakub Jelinek > > PR tree-optimization/109154 > * value-range.h (frange::flush_denormals_to_zero): Make it public > rather than private. > * value-range.cc (frange::set): Don't call flush_denormals_to_zero > here. > * range-op-float.cc (range_operator_float::fold_range): Call > flush_denormals_to_zero. > > --- gcc/value-range.h.jj 2023-03-23 15:25:47.059741131 +0100 > +++ gcc/value-range.h 2023-03-27 18:56:35.164190929 +0200 > @@ -373,6 +373,7 @@ public: > void update_nan (tree) = delete; // Disallow silent conversion to bool. > void update_nan (const nan_state &); > void clear_nan (); > + void flush_denormals_to_zero (); > > // fpclassify like API > bool known_isfinite () const; > @@ -389,7 +390,6 @@ private: > bool union_nans (const frange &); > bool intersect_nans (const frange &); > bool combine_zeros (const frange &, bool union_p); > - void flush_denormals_to_zero (); > > tree m_type; > REAL_VALUE_TYPE m_min; > --- gcc/value-range.cc.jj 2023-03-27 12:50:45.876826415 +0200 > +++ gcc/value-range.cc 2023-03-27 18:45:50.127495492 +0200 > @@ -361,8 +361,6 @@ frange::set (tree type, > > normalize_kind (); > > - flush_denormals_to_zero (); > - > if (flag_checking) > verify_range (); > } > --- gcc/range-op-float.cc.jj 2023-03-27 13:28:18.847264635 +0200 > +++ gcc/range-op-float.cc 2023-03-27 18:50:24.498537727 +0200 > @@ -112,6 +112,8 @@ range_operator_float::fold_range (frange > } > } > > + r.flush_denormals_to_zero (); > + > return true; > } > > > Jakub >