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 6B8A638582B2 for ; Mon, 5 Sep 2022 09:41:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6B8A638582B2 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=1662370910; 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=R5V77CaDLb+wE6K09nx4Z//9v3ZiFEFYK8K0A3C9Sl0=; b=cyHJ/2ISwEdQSib9rOxQ4nsxshCp/0412J3EeeakSEFLu7E/4ZocwvgPX6bYHTfreWs/nf wti8++c5sS581PK/uIC10gi0sxCKYHBg9egLM11SEaQRrYs0W/UTXcQQGopmzATvgoBBtU 3kstAryC5lQTOIN+sp8SI1gxmZTJZ2s= Received: from mail-oa1-f72.google.com (mail-oa1-f72.google.com [209.85.160.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-28-RxjQp1kIMkGvJS0hPxXsZw-1; Mon, 05 Sep 2022 05:41:48 -0400 X-MC-Unique: RxjQp1kIMkGvJS0hPxXsZw-1 Received: by mail-oa1-f72.google.com with SMTP id 586e51a60fabf-11f1971030fso4458957fac.16 for ; Mon, 05 Sep 2022 02:41:48 -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=R5V77CaDLb+wE6K09nx4Z//9v3ZiFEFYK8K0A3C9Sl0=; b=E5a4Z6hD8EXCQrN941JbWFld88n+XrFmKf3AlynhBV+/Mo2gdJa1Zqe4XSfJ6F/n6x +BPN1t3wEHCY4lpeR/mKgFoFYjxUF5xloadHigHGUekQq/UDp3acHcaWFzXGkW1+EjXa y3LxiuUVUGl+qwP8Jlb0/HTkWcP/c07rNK37J87oJtLAFCHsnLqRGLv5/+VicAD8KpjL O70ZlKBedpzdRdHM80v0n6RCUurQJ2QvAPzhCcwuifhs94dmYHmaiVt62kl6Y+5tjWx6 QmnAdcgpcoDHCrklX1Ui5vEzVO+WaJt4D4b3DBC3T5GxL8nYByLITRLzFIqhBDzXfQc7 aZgA== X-Gm-Message-State: ACgBeo23SxnqsEmYpt0e6Ci9wUqGT22PP9Bis+GphL/biQOH4QBCX2Ms iM9qpClcBzoIy4t61QomMGsd88LFatZcl0d8wq56NPMNoBUUj/HDEFGwB1S3Vqu1Co9XP95xo/O N/it6N0ZaxHFAFFwjSztioGCcgmf/5kU8+Q== X-Received: by 2002:a4a:5e82:0:b0:44a:fe22:baff with SMTP id h124-20020a4a5e82000000b0044afe22baffmr16806050oob.86.1662370907455; Mon, 05 Sep 2022 02:41:47 -0700 (PDT) X-Google-Smtp-Source: AA6agR4sJsw/suFjOdHmDIUeB7NlqxLFDhIiaR/CeiMBnoHrtpFH+h38jv/jdEtOmTXF/qhthAjcCLJazuXdPxV9a5M= X-Received: by 2002:a4a:5e82:0:b0:44a:fe22:baff with SMTP id h124-20020a4a5e82000000b0044afe22baffmr16806045oob.86.1662370907207; Mon, 05 Sep 2022 02:41:47 -0700 (PDT) MIME-Version: 1.0 References: <20220905062301.3240191-1-aldyh@redhat.com> In-Reply-To: From: Aldy Hernandez Date: Mon, 5 Sep 2022 11:41:36 +0200 Message-ID: Subject: Re: [COMMITTED] Be even more conservative in intersection of NANs. To: Richard Biener Cc: Jakub Jelinek , "MacLeod, Andrew" , GCC patches X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-5.3 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 Mon, Sep 5, 2022 at 11:18 AM Richard Biener wrote: > > On Mon, Sep 5, 2022 at 11:12 AM Aldy Hernandez 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. > > > > Right. I don't print any of the "maybe" properties, just if they're > > definitely set or definitely clear. I'm open to suggestions as to how > > to display them. Perhaps NAN, !NAN, ?NAN. > > There's no NAN tristate. Your "definitely NAN" would be simply > ][ NAN, that is, the value range only contains NAN. Your !NAN > is and non NAN. Likewise for the sign, the > range either includes -NAN and NAN or one or none of those. > For signed zeros you either have [-0, upper-bound] or [0, upper-bound] > where it either includes both -0 and 0 or just one of them But there is a tristate. We may definitely have a NAN, definitely not have a NAN, or the state of the NAN is unknown. Say [3,5] ?NAN. That's [3,5] with the possibility of a NAN. On the true side of x >= 5.0, we'd have [5.0, INF] !NAN. On the false side we'd have [-INF, 5.0] ?NAN. With this representation we can fold __builtin_isnan() even on an unknown value... say on the true side of x == y we know that both x and y cannot be NANs...but on the false side we know nothing so there is the possibility of a NAN. I do like your idea for signed zeros. I think I could make it work and get rid of the sign bit. Aldy > > > I'm mostly worried about removing a NAN from the IL that was going to > > signal, or some such. While I agree with you Richard, I just want to > > make real sure, because getting something wrong in the frange or > > range-ops bowels means the problem becomes pervasive to all of ranger > > ...and threader...and loop ch...and vrp, etc etc. I just want to take > > more time to test things. I promise it won't stay varying too long. > > There's sNANs and qNANs, but I think for value-ranges we should > concern ourselves only with qNANs for now and leave sNANs VARYING. > All operations only ever produce qNANs (loads can produce sNANs). > > Richard. > > > Aldy > > >