From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by sourceware.org (Postfix) with ESMTPS id 5EA0A3858427 for ; Fri, 26 Aug 2022 17:40:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5EA0A3858427 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-pg1-x52b.google.com with SMTP id s206so1987197pgs.3 for ; Fri, 26 Aug 2022 10:40:46 -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; bh=jRBZqk0oDZ3FzlPPLRU+msq4QfMX/SY5L6OcL64OY7Q=; b=dsrlAuQSo4A9NKpLaikyWhWiIKffaFW915UtjtD9sM9iqXjumotlD/1XEup30pbIhV h8/kqXkAe6vtX8zQ8KU6O+r60JqRoB2YMeMcqHHELyOZUcnrcYKHE418sVZ4TeC0DJie loQu1uODrLNaTBgN43XOYfJlpJ+SgPC0mUHK8BD9QyrLJq3iSt+xkBg21oObyOby90Wp ogfdKC22HrRVGXtXRgPjGgk6eB2SgBBIFk8XONPqdTleFXJ7f+AgQZ8udG4r3HhXmijc 5IeT03Gw2da+TPVgcClIM4kRR5qO/8iIm5xZquh5AiqYXWsm75s/zAAFANUtHpJRRww1 bhiw== 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; bh=jRBZqk0oDZ3FzlPPLRU+msq4QfMX/SY5L6OcL64OY7Q=; b=xq9dfLsdN70lP/uBGxrlRiCVW+EoL3MtaXlcab6j1Ph3YDAukC1CTlVNANHuHrfYcA enjR3DJtKDG7+A9caRtjJz8qFbV67JqvdM1586KIXFftGMNghUKP+A3q9i8YPE67kf4/ MkrVHTM+V5DqA8eIOPbSeiGaqO81+PFAGPPdOFy0/MpS+2ElIHs/bqsQdHl8aGNZBqq9 hQ+b1/JEWj3PZjGwbLyfw7Fcn2Fm6FT3uCYyW92l4vHXgCVUf36PBZ4p1uqQE20ZcuyU 57p11ptTU5EL+FiABsJFl403Qjn7cgizUE/631KgMPR627U25gy+e622k0Tst/XcL/U9 T+0w== X-Gm-Message-State: ACgBeo3Rn3NdW9fqJCNVcpNiXRQH8cyRRG4BJ/ZLR9sXkNinDrkjwDbi Q5F944l/I+zC5aRs9eCJIyHGeE3/lUN1QNHwzNk= X-Google-Smtp-Source: AA6agR4o0TTi2K0hE7XeSWcIlwd6Q95Ng2ijZ7xqzPGroYJ5FmBNX5no2wmty61zmpwKFpBlGkaY8xhxhHtndWvCHxM= X-Received: by 2002:a63:6c49:0:b0:41d:e04a:dd7d with SMTP id h70-20020a636c49000000b0041de04add7dmr3967815pgc.243.1661535645077; Fri, 26 Aug 2022 10:40:45 -0700 (PDT) MIME-Version: 1.0 References: <20220823114224.904934-1-aldyh@redhat.com> In-Reply-To: From: Andrew Pinski Date: Fri, 26 Aug 2022 10:40:31 -0700 Message-ID: Subject: Re: [PATCH] Add support for floating point endpoints to frange. To: Aldy Hernandez Cc: GCC patches , Andrew MacLeod , Jakub Jelinek Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 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 Fri, Aug 26, 2022 at 8:55 AM Aldy Hernandez wrote: > > [pinskia: I'm CCing you as the author of the match.pd pattern.] > > So, as I wrap up the work here (latest patch attached), I see there's > another phiopt regression (not spaceship related). I was hoping > someone could either give me a hand, or offer some guidance. > > The failure is in gcc.dg/tree-ssa/phi-opt-24.c. > > We fail to transform the following into -A: > > /* { dg-options "-O2 -fno-signed-zeros -fdump-tree-phiopt" } */ > > float f0(float A) > { > // A == 0? A : -A same as -A > if (A == 0) return A; > return -A; > } > > This is because the abs/negative match.pd pattern here: > > /* abs/negative simplifications moved from fold_cond_expr_with_comparison, > Need to handle (A - B) case as fold_cond_expr_with_comparison does. > Need to handle UN* comparisons. > ... > ... > > Sees IL that has the 0.0 propagated. > > Instead of: > > [local count: 1073741824]: > if (A_2(D) == 0.0) > goto ; [34.00%] > else > goto ; [66.00%] > > [local count: 708669601]: > _3 = -A_2(D); > > [local count: 1073741824]: > # _1 = PHI > > It now sees: > > [local count: 1073741824]: > # _1 = PHI <0.0(2), _3(3)> > > which it leaves untouched, causing the if conditional to survive. > > Is this something that can be done by improving the match.pd pattern, > or should be done elsewhere? Oh the pattern which is supposed to catch this does: (simplify (cnd (cmp @0 zerop) integer_zerop (negate@1 @0)) (if (!HONOR_SIGNED_ZEROS (type)) @1)) Notice the integer_zerop here. fold_cond_expr_with_comparison has integer_zerop there too. I am not 100% sure you can replace A_2 with 0.0 where you are doing it as mentioned in another thread. Thanks, Andrew Pinski > > Thanks. > Aldy