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 807F43851AB4 for ; Tue, 6 Sep 2022 07:41:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 807F43851AB4 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=1662450072; 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: in-reply-to:in-reply-to:references:references; bh=URIqljlRE8rWRuVSZnZ15EFsh51wV3qM87HKyvG8MYI=; b=AtyohWGWpgIvRXRsSko6Wg+eSyE/CKUBsSR7Y7SkrwFQhQr5SHN8e74kGqjfC8SaUTiKfq kGWdDK/GE+oIouRvwPlmKqCrAo+8XseCP0oaTIWqbQNZeBuUNm9GJ8iRt6w/yxrMgL5Xnb PjRUzkP7FoeD64zn/GcukdJJuZ0Y3UI= Received: from mail-ot1-f69.google.com (mail-ot1-f69.google.com [209.85.210.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-484-b7tn1ZABNxWFvtVPRMeitg-1; Tue, 06 Sep 2022 03:41:10 -0400 X-MC-Unique: b7tn1ZABNxWFvtVPRMeitg-1 Received: by mail-ot1-f69.google.com with SMTP id r28-20020a056830237c00b006392b014be9so6051598oth.0 for ; Tue, 06 Sep 2022 00:41:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=URIqljlRE8rWRuVSZnZ15EFsh51wV3qM87HKyvG8MYI=; b=wvWqIpcxXFjAubV4TLmM3E9IS/t1glGtcJeYJrTSTeVPALtW1tod2IddjzHMvEV5BT efBLCvliUGKCjqp20bO/LU8z4WMjDYHpYP1mXnaiY7hcyJ0MqISHbTjNABOXcRlhV8/m lBqr48+ggmFl/fZbacgXuNWU6SCKHV4R0sY2x9UQ3Bbx3a7c/kyQIoTDEXygr/4SXHyc OdplOhx/zpHJx2ujGDiHuSgG7RodCInVZFNkM+q3g9exNZJD0d//lKuY9c4xmNXLFdIo pQWsCJOPhPCEN8dwduCGRHA3oqz8QH0HZaLS54ofXLmRycaa6MWVn1L8gIl1uageQjxN zOEA== X-Gm-Message-State: ACgBeo1VxPq2PHgicJk45xTtGAb9K1cPVuzoYKCbwsL1Dig/UuGqCQm3 lNRGsy55c4V4GcWi9QCyZzrDH34ofwM1iWR8WnlU2p+K+Y1dhVlctOsMAwrx7loBjzXyk2R5sX+ muqRZU5FIs1exmXQOrePkBPjVEyfdmemKwA== X-Received: by 2002:a05:6808:f0f:b0:343:2e0e:ac52 with SMTP id m15-20020a0568080f0f00b003432e0eac52mr8913661oiw.36.1662450070297; Tue, 06 Sep 2022 00:41:10 -0700 (PDT) X-Google-Smtp-Source: AA6agR5KOMJFYxOD+s0+lWnfcHSjuFY3l9I1e+QvedgGVO8F3RLp1FrOjwzkLF4MQyfP9Koaauxm9fn3HEdx5Zv43fo= X-Received: by 2002:a05:6808:f0f:b0:343:2e0e:ac52 with SMTP id m15-20020a0568080f0f00b003432e0eac52mr8913658oiw.36.1662450070090; Tue, 06 Sep 2022 00:41:10 -0700 (PDT) MIME-Version: 1.0 References: <20220906072901.3472801-1-aldyh@redhat.com> In-Reply-To: From: Aldy Hernandez Date: Tue, 6 Sep 2022 09:40:59 +0200 Message-ID: Subject: Re: [PATCH] Handle > INF and < INF correctly in range-op-float.cc To: Jakub Jelinek Cc: GCC patches , Richard Biener , Andrew MacLeod X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE 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: On Tue, Sep 6, 2022 at 9:35 AM Jakub Jelinek wrote: > > On Tue, Sep 06, 2022 at 09:29:01AM +0200, Aldy Hernandez wrote: > > The gfortran.dg/minlocval*.f90 tests are generating conditionals past > > the infinities. For example: > > > > if (x <= +Inf) > > foo (x); > > else > > bar (x); > > > > It seems to me that the only possible value for x on the false side is > > either NAN or undefined (for !HONOR_NANS). > > No, none of the ==, <, <=, >, >= comparisons are ever true if one > or both operands are NaN (only != will be true in those cases from the > standard comparisons, when not counting UNORDERED_EXPR and the likes). > So, x < -Inf or x > +Inf are always false, we just can't optimize those > away without -ffast-math because they could raise an exception on sNaN. > But I think not optimizing such operations away if we care about exceptions > is the duty of DCE etc. No, no. I'm not talking about optimizing them away. I'm talking about representing what is going on in the IL. For example, for: if (x > 5.0) foo (x); // {5.0, +Inf] !NAN else bar (x); // [-Inf, 5.0] ?NAN So on the true side we know x is in the {5.0, +Inf] range, plus we know it can't be a NAN. On the false side we know x is either [-Inf, 5.0] or a NAN. What I'm trying to do is represent the possible ranges for the false side of: if (x <= Inf) ... Aldy