From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by sourceware.org (Postfix) with ESMTPS id DB2F23858D32 for ; Mon, 5 Sep 2022 09:41:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DB2F23858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-x629.google.com with SMTP id cu2so15998637ejb.0 for ; Mon, 05 Sep 2022 02:41:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=xf78hriNYwQ/lHkqAvp2QW6VpzHTVjFOBL9HxZe8m1w=; b=MSmg2EuCJkxxHb0Tytg6YjZ9ZpXT5x6DwjstD3iw2o9Y7M9oallq24y/koLZ560cm1 aJ+QjL9kA+fUKQIaLrIb0Df5+oCXHBvh3YnM/+EFbqxT5qXxombLGt0XsdAy/kQC/QAd 9f4mtrQ2dXqogFnk4xROm0ao4d4Dwumf4ElXL0uxuwu26WEUN72S2PkrXDxsbBWgl9un Z5XkQTF0KFZFMYIHIuJEFKRSCD5kw3zC3nSFQaCvMLx9Fb5sqkCgmYmnNUwtraMCKSw+ 2LWgaXpdbOBKN6sEBip6s0cqavSOrPhIfyrt7Ynrdeu63GccGV+QVSGjsEfog+HRucBC 4fYg== 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=xf78hriNYwQ/lHkqAvp2QW6VpzHTVjFOBL9HxZe8m1w=; b=p1CvKfg9LiDe1GU/qNxOcT7/4Fnq4JkwQlH276GDbABviyR3+67FTslsEBWQR0jHju /xuQJDT1J1kGwOcNjTcYGAzHDuNzDa+aJREeRI1Ygv2oNA/pMXs9lbM3enEa5JbqTWa5 DwOjd00JIqbh5jFztgQzwjCrzFU1NSnDiJLpJYwubtylWceB/7+WK1s0Br88jaKj01W8 IeHhA/zO5VJ/sqiT7DKAfIYA7QdroWJRQt1SEgMg9zYnVIVAPK6X0w+ty0OxHJ3pqMm0 9WNp4aZJA5uBCjGlWTlYokl3pldgyGn99f4xzkzrbIIu3hclxzveSmZDwZItm5BuKB2C dpvA== X-Gm-Message-State: ACgBeo1AQM1LCTzboVJpXiyYIHZP0PLIwGpGls17PsI5f5SJELev8FR+ wG3nzpua7kW8SOjv9r66Nd6EsHKAHJcWxASSm3c= X-Google-Smtp-Source: AA6agR4Uh1YOH+g8jSDsjqwg7/zkSoVj+sUgW/rIJCwpLZI3aGvlBKT0N8en5OSSiCeP51GBk7DfQHOrAIlXvJGlWGU= X-Received: by 2002:a17:907:2722:b0:731:23a3:be78 with SMTP id d2-20020a170907272200b0073123a3be78mr35364770ejl.330.1662370883565; Mon, 05 Sep 2022 02:41:23 -0700 (PDT) MIME-Version: 1.0 References: <20220905062301.3240191-1-aldyh@redhat.com> In-Reply-To: From: Richard Biener Date: Mon, 5 Sep 2022 11:41:11 +0200 Message-ID: Subject: Re: [COMMITTED] Be even more conservative in intersection of NANs. To: Aldy Hernandez Cc: Jakub Jelinek , GCC patches Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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 Mon, Sep 5, 2022 at 11:28 AM Aldy Hernandez wrote: > > On Mon, Sep 5, 2022 at 11:14 AM Richard Biener > wrote: > > > > On Mon, Sep 5, 2022 at 11:06 AM Jakub Jelinek wrote: > > > > > > On Mon, Sep 05, 2022 at 11:00:54AM +0200, Richard Biener wrote: > > > > On Mon, Sep 5, 2022 at 8:24 AM Aldy Hernandez via Gcc-patches > > > > wrote: > > > > > > > > > > Intersecting two ranges where one is a NAN is keeping the sign bit of > > > > > the NAN range. This is not correct as the sign bits may not match. > > > > > > > > > > I think the only time we're absolutely sure about the intersection of > > > > > a NAN and something else, is when both are a NAN with exactly the same > > > > > properties (sign bit). If we're intersecting two NANs of differing > > > > > sign, we can decide later whether that's undefined or just a NAN with > > > > > no known sign. For now I've done the latter. > > > > > > > > > > I'm still mentally working on intersections involving NANs, especially > > > > > if we want to keep track of signbits. For now, let's be extra careful > > > > > and only do things we're absolutely sure about. > > > > > > > > > > Later we may want to fold the intersect of [NAN,NAN] and say [3,5] > > > > > with the posibility of NAN, to a NAN, but I'm not 100% sure. > > > > > > > > The intersection of [NAN, NAN] and [3, 5] is empty. The intersection > > > > of [NAN, NAN] and VARYING is [NAN, NAN]. > > > > > > I think [3.0, 5.0] printed that way currently means U maybe NAN, > > > it would be [3.0, 5.0] !NAN if it was known not to be NAN. > > > > Uh, that's confusing. So [3, 5] U maybe NAN intersected with > > ][ NAN is ][ NAN. [3, 5] !NAN intersected with ][ NAN is ][ !NAN. > > I'm confused. What's ][ ??. It's the empty range. > For clarity in the discussion, let's say ?NAN, NAN, and !NAN for the > NAN property. > > I would expect: > [3,5] ?NAN U NAN = [3,5] ?NAN > [3,5] !NAN U NAN = [3,5] ?NAN > [3,5] !NAN ^ NAN = [] > NAN !SIGN ^ NAN SIGN = [] (differing signs) > [3,5] ?NAN ^ NAN = NAN > [3,5] !NAN ^ NAN = [] > > Also, definite NANs must have a real_nan() on both sides of the > endpoints. They must be the same. And that real_nan() could have a > sign bit. So we could have: > [NAN, NAN] ?SIGN (sign unknown-- default) > [NAN, NAN] SIGN (negative NAN) > [NAN, NAN] !SIGN (positive NAN) > > The above is enforced by the setter and verify_range. I think having NAN in the endpoints is confusing since NANs do not behave with ordered compares. That is, [-NAN, +NAN] would not make sense. A value-range of either -INF or +INFs would be a two element [-INF, -INF] U [+INF, +INF] range. So a definite NAN should IMHO be ][ (empty range of non-NAN values) U NAN. And if there's a negative and a positive NAN then we probably should simply have two NAN flags, +NAN and -NAN. I'm not sure how tracking the sign bit separately is useful. "sign bit set" is simply [-INF, -0] U -NAN (if the value could be a NAN)? > Note, that setting the definite NAN property (fp_prop::YES) to a > range, makes it a NAN. That is, we will forcibly change the range to > [NAN, NAN]. There's also an assert making sure you're not setting > !NAN on a [NAN, NAN]. > > A varying has all the property bits set to unknown. So effectively > ?NAN and ?SIGN. > > Do you agree? No, I'm very confused about having [3, 5] ?NAN, [3, 5] NAN and [3, 5] !NAN. Richard. > Aldy > > > > > In fact [3, 5] U maybe NAN is just [3, 5] U NAN, there's no "maybe" ranges, > > if the value may be NAN then NAN is in the value-range. So it's either > > [3, 5] U NAN or [3, 5] (without U NAN). > > > > Richard. > > > > > > > > Jakub > > > > > >