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 4F7463851149 for ; Fri, 26 Aug 2022 19:16:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4F7463851149 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=1661541385; 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=t61EC4h/W6svHYNn/r0rHRzyXOvLxEaGHhdDecs61Sc=; b=cZ9+nvtL/bKWoY47+kDom58XA8XGLKFPvlqz+czfekoTuWJl0xbhbPF/j/GIbroHHT3OkK V8cpgA+FNQQBnyG8N4Me+nm76VwkB2DdzraTOxhC6p/LRd2KU3Cw3yK935Pt6G7qPHmCJX B++++YJ8Mvevs2rA1btNIxXkgVqhPkY= Received: from mail-oi1-f200.google.com (mail-oi1-f200.google.com [209.85.167.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-592-S8rXCHs6MpGFBtZxzrY1kA-1; Fri, 26 Aug 2022 15:16:22 -0400 X-MC-Unique: S8rXCHs6MpGFBtZxzrY1kA-1 Received: by mail-oi1-f200.google.com with SMTP id x17-20020a056808145100b00344f0608cbaso953479oiv.0 for ; Fri, 26 Aug 2022 12:16:21 -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=t61EC4h/W6svHYNn/r0rHRzyXOvLxEaGHhdDecs61Sc=; b=ZKaKW3mvfFlb4kuhqMpHzw0BDiFw7zliBMsyd7fdc3OqE0Ywkf1jxjbUGLTL7eV6or mSxqCQywHQZWEzSi6LhGRxkidMCeYRvi87LJ1ZXCXwhu2PnxHH9eUayRx1aMdnwoHd+F 9slUMOg8nUSs8xxJL+HRAlXfTDLZ/iySMA4HI2EmdtC851+RE/UnKYrthBhFCR5ulEmb x7Rb77G51NmX0JCRs2s1H4yJWKjqVEXznw5wCL2SYp7zwrQ1c81U5R5Shyqk8oLfJd6d vnFjx4ZEB1uCSWeEyT11N2NvCleFNqYOOfJqJJ1h5OpWqjTqT8oEHxX+vbPNeMqYdpWd 8vGQ== X-Gm-Message-State: ACgBeo1ZTIeu9b8v7KrX/ppzKrmLZ1yTRzWw60fJq4IdZxfWqBjW+pne ZDlZuI4xKp+m7gZNhICMKp8vDzriY8I+rA3IQtcA/sTxHQnH2kc8aLneIzou+9SDij/s2xoeJQZ mFt49FLBueTvsmyeEvV59Fc7k0PzzHY6daw== X-Received: by 2002:a05:6808:f07:b0:344:7739:8e7b with SMTP id m7-20020a0568080f0700b0034477398e7bmr2263814oiw.265.1661541381296; Fri, 26 Aug 2022 12:16:21 -0700 (PDT) X-Google-Smtp-Source: AA6agR6LOdylEZES0w+6Fb8tVZKUHpd/XOfPBnU4Vd8hmFhRCw6WR9zuV7cbFqx3mlUzOehNNUPPjxpU7eUTtDcOxmc= X-Received: by 2002:a05:6808:f07:b0:344:7739:8e7b with SMTP id m7-20020a0568080f0700b0034477398e7bmr2263798oiw.265.1661541381071; Fri, 26 Aug 2022 12:16:21 -0700 (PDT) MIME-Version: 1.0 References: <20220823114224.904934-1-aldyh@redhat.com> In-Reply-To: From: Aldy Hernandez Date: Fri, 26 Aug 2022 21:16:09 +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: text/plain; charset="UTF-8" X-Spam-Status: No, score=-5.7 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 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? Aldy