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 A702B3851151 for ; Fri, 26 Aug 2022 18:12:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A702B3851151 Received: from mail-ot1-f71.google.com (mail-ot1-f71.google.com [209.85.210.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-398-FeX4RM0CM9KVog7gUEJmog-1; Fri, 26 Aug 2022 14:12:08 -0400 X-MC-Unique: FeX4RM0CM9KVog7gUEJmog-1 Received: by mail-ot1-f71.google.com with SMTP id j19-20020a9d7393000000b00639226c791fso1025455otk.6 for ; Fri, 26 Aug 2022 11:12:07 -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; bh=YRj0wyVIPv2nCG8ImoTrQoQLRD9Eger/6SU9NgjHvgo=; b=ZlsDAAzJL8cJvKmNCmGzymNkZ3g4qJOcbZdvqxOqEQdxFjuYE1+EdECl28g5H0I/8M dODpn8uGTNgUysU4W8B0IyXLvD9aomJvkuTdpbcnDzAIrtLsZsUf7D8okr9N/tmJVi2q ipBbTE02wB12k8gJaD9zAxO3DH1x/VzHkGxmXjuYim9QP1B1bMYl4ihnn2zRzUJ/1p7Y g6QkoYWq7xRQ3ptwUtp1hJLA0TbPBimG7xAEbVyX4xaUUjoPlMLRReSfkMepUOkc02AG 7zZI0dJQ2gBattUnKKN2kqKSuFCcdJPyeP6ZQi53//1cotD/1NOGy2eMaX4fW+PepGgV eV1Q== X-Gm-Message-State: ACgBeo3VMCzXsKYsmubYDDAAqSf/We0AWaQcPpyAwWnQqgOAnN4knWmM 7dl9s12gC7exku/FECwplqEDxUzWGIqUR4uMkfbW/LQPKbs+dc10lmxMTReLoisuoj0bK3WQVCS 2OY0iOCnZa9WGgW7qQY/8Lw2dt9K4aloFIQ== X-Received: by 2002:a05:6808:f07:b0:344:7739:8e7b with SMTP id m7-20020a0568080f0700b0034477398e7bmr2154053oiw.265.1661537527322; Fri, 26 Aug 2022 11:12:07 -0700 (PDT) X-Google-Smtp-Source: AA6agR5sNPVSoXfSVz3C0NLPLB2z03vutAbuiK89m659b07yx51iU9MdCeMw0fmWwIdlkGvrxwCOxZ1kZydQBUUSyh8= X-Received: by 2002:a05:6808:f07:b0:344:7739:8e7b with SMTP id m7-20020a0568080f0700b0034477398e7bmr2154039oiw.265.1661537527035; Fri, 26 Aug 2022 11:12:07 -0700 (PDT) MIME-Version: 1.0 References: <20220823114224.904934-1-aldyh@redhat.com> In-Reply-To: From: Aldy Hernandez Date: Fri, 26 Aug 2022 20:11:56 +0200 Message-ID: Subject: Re: [PATCH] Add support for floating point endpoints to frange. To: Andrew Pinski Cc: GCC patches , Andrew MacLeod , Jakub Jelinek X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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, HTML_MESSAGE, 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 Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Aug 2022 18:12:13 -0000 On Fri, Aug 26, 2022, 19:40 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)) > > 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. > Are you sure we can't make the replacement, cause the test runs with -fno-signed-zeros? Aldy > Thanks, > Andrew Pinski > > > > > > Thanks. > > Aldy > > 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 A702B3851151 for ; Fri, 26 Aug 2022 18:12:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A702B3851151 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=1661537531; 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=YRj0wyVIPv2nCG8ImoTrQoQLRD9Eger/6SU9NgjHvgo=; b=R+l6WWzP+TmHPvWyckWLmaFa36nkBYMK+Am7aRiJ4Zrl9rXN3TrDC5wH/fw7mcEARYsXpo OnxXTrb/s5emaGtJZ7WwRlivK2nWu4eRgO0nUKSF87+6QW0szo+JY8R/qMiJF0EZIezmTF HvYYeltO6ap/ejStOJS/1VzCUmnrBhE= Received: from mail-ot1-f71.google.com (mail-ot1-f71.google.com [209.85.210.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-398-FeX4RM0CM9KVog7gUEJmog-1; Fri, 26 Aug 2022 14:12:08 -0400 X-MC-Unique: FeX4RM0CM9KVog7gUEJmog-1 Received: by mail-ot1-f71.google.com with SMTP id j19-20020a9d7393000000b00639226c791fso1025455otk.6 for ; Fri, 26 Aug 2022 11:12:07 -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; bh=YRj0wyVIPv2nCG8ImoTrQoQLRD9Eger/6SU9NgjHvgo=; b=ZlsDAAzJL8cJvKmNCmGzymNkZ3g4qJOcbZdvqxOqEQdxFjuYE1+EdECl28g5H0I/8M dODpn8uGTNgUysU4W8B0IyXLvD9aomJvkuTdpbcnDzAIrtLsZsUf7D8okr9N/tmJVi2q ipBbTE02wB12k8gJaD9zAxO3DH1x/VzHkGxmXjuYim9QP1B1bMYl4ihnn2zRzUJ/1p7Y g6QkoYWq7xRQ3ptwUtp1hJLA0TbPBimG7xAEbVyX4xaUUjoPlMLRReSfkMepUOkc02AG 7zZI0dJQ2gBattUnKKN2kqKSuFCcdJPyeP6ZQi53//1cotD/1NOGy2eMaX4fW+PepGgV eV1Q== X-Gm-Message-State: ACgBeo3VMCzXsKYsmubYDDAAqSf/We0AWaQcPpyAwWnQqgOAnN4knWmM 7dl9s12gC7exku/FECwplqEDxUzWGIqUR4uMkfbW/LQPKbs+dc10lmxMTReLoisuoj0bK3WQVCS 2OY0iOCnZa9WGgW7qQY/8Lw2dt9K4aloFIQ== X-Received: by 2002:a05:6808:f07:b0:344:7739:8e7b with SMTP id m7-20020a0568080f0700b0034477398e7bmr2154053oiw.265.1661537527322; Fri, 26 Aug 2022 11:12:07 -0700 (PDT) X-Google-Smtp-Source: AA6agR5sNPVSoXfSVz3C0NLPLB2z03vutAbuiK89m659b07yx51iU9MdCeMw0fmWwIdlkGvrxwCOxZ1kZydQBUUSyh8= X-Received: by 2002:a05:6808:f07:b0:344:7739:8e7b with SMTP id m7-20020a0568080f0700b0034477398e7bmr2154039oiw.265.1661537527035; Fri, 26 Aug 2022 11:12:07 -0700 (PDT) MIME-Version: 1.0 References: <20220823114224.904934-1-aldyh@redhat.com> In-Reply-To: From: Aldy Hernandez Date: Fri, 26 Aug 2022 20:11:56 +0200 Message-ID: Subject: Re: [PATCH] Add support for floating point endpoints to frange. To: Andrew Pinski Cc: GCC patches , Andrew MacLeod , Jakub Jelinek X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/alternative; boundary="00000000000014908305e728da3a" 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,HTML_MESSAGE,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: Message-ID: <20220826181156.XWaDVnXaxkcks21T-vGOYGO9FE3DxVBEc34ZdUqrc28@z> --00000000000014908305e728da3a Content-Type: text/plain; charset="UTF-8" On Fri, Aug 26, 2022, 19:40 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)) > > 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. > Are you sure we can't make the replacement, cause the test runs with -fno-signed-zeros? Aldy > Thanks, > Andrew Pinski > > > > > > Thanks. > > Aldy > > --00000000000014908305e728da3a--