From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by sourceware.org (Postfix) with ESMTPS id 34127385AE58 for ; Fri, 26 Aug 2022 19:44:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 34127385AE58 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-pl1-x62e.google.com with SMTP id u22so2410692plq.12 for ; Fri, 26 Aug 2022 12:44:39 -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=UrzLSCDrFsbomlFlKMwN5iXxdtRsUMAaAUrrr7PHcw4=; b=SUcatmLhLEuUfnlMJui+PP9TvsSGiPylNkw6xk9WggI8f8aa72VW7dfSOKqMrfyG3N Vi13fBKof2FHQjUcUdO8ZgT6ne2slfwknogiWMGk+egOfaCZ+5ESbW5M4NLcdSxXZk8F nCAiQVqifiL+takTqUzQCcsk2lyCpDRUZjpvsO71wM/ZJqPJyfiJOzs6b9DbU1FpNoKt V2tGH9hIOU/tIcU6vcw7/MefGRQldjdBECsYJC2N3gVcAyS1L7n2eBLJ0AMFnE/gp5CY 2fedfKUyYe7OQSpRBv68jYVXVFi9fKiwsHQ3is+XcdFjkWilpoxICtyPpAt1y1IwZE3R ffIA== 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=UrzLSCDrFsbomlFlKMwN5iXxdtRsUMAaAUrrr7PHcw4=; b=wOHhO/Hha7RXRuqMlm2Fuf67bFwP0D6j4bVdF1NKhVCFJdQDIvjZy1K1Cq6Z6A3Bpo 1vvvITG8DmxJ+hDM2yYDD7bX3QX3M5kzVCi1GYHdaTcT0gqzvAxM7suaNDVd3y5zMjZb 5zXHh+ATbT1q3sUmx//2bdK6jP1yQosl7FWe1MFWieY4g5daMU+ZJ5RvRaVHb2/eW7Vz QL5HhMqHBCP8v7LXiM+q8T0sypu4Y8hCLFrFUSbzT5di6/PDhTkjwSGHkgsmdJf9Kv9M nEgYt6TLp9McT6HOE3JX64uB9qgoxoET/9/WPPmyZE+kVpbhTxzw/vw8n2ttshiLUw9K /qWw== X-Gm-Message-State: ACgBeo2/XPCEtlrZAB14HkPq0QIG7xmHUaRc9BVtidcxKBJTdjXPnOtl OYfC+hDnTlN7K6lYjEYvLM5VKq2+65db9SUIwpg= X-Google-Smtp-Source: AA6agR70mv640E2d3gJvEShFQpA/GVxqmMP0MqoEfzJFTKMPLSZK8jvdDB1iLEddzY7S1ePv/ZCrs+8PV38WNYZyJ2E= X-Received: by 2002:a17:90b:1803:b0:1fb:45e2:5d85 with SMTP id lw3-20020a17090b180300b001fb45e25d85mr6041712pjb.163.1661543078145; Fri, 26 Aug 2022 12:44:38 -0700 (PDT) MIME-Version: 1.0 References: <20220823114224.904934-1-aldyh@redhat.com> In-Reply-To: From: Andrew Pinski Date: Fri, 26 Aug 2022 12:44:25 -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 12:16 PM Aldy Hernandez wrote: > > On Fri, Aug 26, 2022 at 7:40 PM Andrew Pinski wrote: > > > > 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)) > > On trunk without any patches, for the following snippet with -O2 > -fno-signed-zeros -fdump-tree-phiopt-folding... > > float f0(float A) > { > // A == 0? A : -A same as -A > if (A == 0) return A; > return -A; > } > > ...the phiopt2 dump file has: > > Applying pattern match.pd:4805, gimple-match.cc:69291, which > corresponds to the aforementioned pattern. So it looks like that was > the pattern that was matching that isn't any more? > > Are you saying this pattern should only work with integers? I am saying the pattern which is right after the one that matches (without your patch) currrently works for integer only. You could change integer_zerop to zerop in that pattern but I am not 100% sure that is valid thing to do. Note there are a few other patterns in that for loop that does integer_zerop which might need to be zerop too. Thanks, Andrew Pinski > > Aldy >