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.133.124]) by sourceware.org (Postfix) with ESMTPS id 5635F38582AB for ; Wed, 9 Nov 2022 10:55:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5635F38582AB 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=1667991315; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=0bggSWISsuqjuTmZGhWATEYGVdAOIiVk+vJOUK5BIcM=; b=AuTIOrj4o58V6XetZKb94MnMAiY/TrQKkTpWnJFxCOhnMITUTa77jeqDHWSHIbUbeZHraM vEMi6JB/rtRVAELT3iXlwnkT1Yk3htHE4Aw0JhsUJE5QfWx+dJ32M055BzdVbb5irNdNPU 3p0mqfM99FBTtc7JOsDIHFS/z1pQsgI= 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-20-BjPbe1qzOn-Ii5xgYwVTrA-1; Wed, 09 Nov 2022 05:55:13 -0500 X-MC-Unique: BjPbe1qzOn-Ii5xgYwVTrA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9A533185A7AC for ; Wed, 9 Nov 2022 10:55:13 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.194.183]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5B10640C6EC3; Wed, 9 Nov 2022 10:55:13 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 2A9AtAkc4104848 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 9 Nov 2022 11:55:10 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 2A9AtA2c4104847; Wed, 9 Nov 2022 11:55:10 +0100 Date: Wed, 9 Nov 2022 11:55:09 +0100 From: Jakub Jelinek To: Aldy Hernandez Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix up foperator_abs::op1_range [PR107569] Message-ID: Reply-To: Jakub Jelinek MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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: Hi! foperator_abs::op1_range works except for the NaN handling, from: [frange] double [-Inf, 1.79769313486231570814527423731704356798070567525844996599e+308 (0x0.fffffffffffff8p+1024)] lhs it computes r [frange] double [-1.79769313486231570814527423731704356798070567525844996599e+308 (-0x0.fffffffffffff8p+1024), 1.79769313486231570814527423731704356798070567525844996599e+308 (0x0.fffffffffffff8p+1024)] +-NAN which is correct except for the +-NAN part. For r before the final step it makes sure to add -NAN if there is +NAN in the lhs range, but the final r.union_ makes it unconditional +-NAN, because the frange ctor sets +-NAN. So, I think we need to clear it (or have some set variant which says not to set NAN). This patch fixes that, but isn't enough to fix the PR, something in the assumptions handling is still broken (and the PR has other parts). Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2022-11-09 Jakub Jelinek PR tree-optimization/107569 * range-op-float.cc (foperator_abs::op1_range): Clear NaNs from the negatives frange before unioning it into r. --- gcc/range-op-float.cc.jj 2022-11-06 11:56:27.138137781 +0100 +++ gcc/range-op-float.cc 2022-11-08 18:13:18.026974667 +0100 @@ -1280,9 +1280,10 @@ foperator_abs::op1_range (frange &r, tre return true; // Then add the negative of each pair: // ABS(op1) = [5,20] would yield op1 => [-20,-5][5,20]. - r.union_ (frange (type, - real_value_negate (&positives.upper_bound ()), - real_value_negate (&positives.lower_bound ()))); + frange negatives (type, real_value_negate (&positives.upper_bound ()), + real_value_negate (&positives.lower_bound ())); + negatives.clear_nan (); + r.union_ (negatives); return true; } Jakub