From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by sourceware.org (Postfix) with ESMTPS id 958193858D32 for ; Fri, 25 Aug 2023 23:12:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 958193858D32 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-pf1-x431.google.com with SMTP id d2e1a72fcca58-68730bafa6bso1718348b3a.1 for ; Fri, 25 Aug 2023 16:12:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693005123; x=1693609923; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=W8WcV7HoGj/WURt5e4kb8nq61plFlZ6Gjx27m5wLGV0=; b=YxbaVNFe/PoljQTE27etVeUBqVuBRF1TW4ZHP672e3GJ8GMlNd78p0bRM4YIp4WNaC yZOVbSHAAyVARvBzU6seYUcsNzYOqXthmgxLFGXK5+N8CvC1Ck67oa0xur6vkoGF8PSb Q/3S4fhXypWYr+K2qA8XBEdQy+WeTMG9c1LuoA+zU90A+BB8QdqNB1CaBjtegjgARJA9 oozMe/frGyNx8HrctGgJvx2YHJ2RTxxToSgNvYS7e+IYgu4XtNof2x1pJspVaG7cHkk0 d2mcKDUc2fXmID7xS4pW3/mX7Hrv5+Pr18dDUEhWygS482L64y+aMm/7jYp0zPJZU0Lf DBUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693005123; x=1693609923; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=W8WcV7HoGj/WURt5e4kb8nq61plFlZ6Gjx27m5wLGV0=; b=F0ftiS0Pz9ZimPkxT5MmHPOz/HkMARS1A1XN+6+orT/3tx4geJyuRzMiVQFdelE3rK fGfgA5sSNDM9QfwR6y1bSIMsesGRqsO2FjZcoiqqrkYncRcPodih43pVlo6oMeq0Lhep sO/ZEOeReWYCTPgGNkUnxFzJHCj6MQntuHqgC5A7ovKvxMWReHcvNePY6eoC0Su3m2tV PG+i0p02POTXIxCSOtUWK5N1vhySYqmN2IhTtECNmpZnCKo2jaueOAP6IVUeU7yqLKVv n2F8kZwI5t5SaAweBK5LTo44FxiHte4Xc/2k8UOgQhnAFyXSwiEtyi+ZLiwCPJXQkIl8 QIxw== X-Gm-Message-State: AOJu0Yxei0QWFboMQGUZFnuG3S9QnOuoo2dV+/7maWSHmHk3cMlJSLN9 LwT3FDMjjLSSGJeVAGpHi6e+t+tGfKgS1wc5/fs= X-Google-Smtp-Source: AGHT+IHwCJPQJW2SsLTZJOjtaDWHrtFlpMIRkR+dhrI2umVxL/oQO+oK+ItFPOSOQBkZKtBWWVEvajavcD3rGGuU7so= X-Received: by 2002:a17:90a:f0d4:b0:26f:b228:faef with SMTP id fa20-20020a17090af0d400b0026fb228faefmr14175721pjb.8.1693005123252; Fri, 25 Aug 2023 16:12:03 -0700 (PDT) MIME-Version: 1.0 References: <20230824191455.3547513-1-apinski@marvell.com> <20230824191455.3547513-3-apinski@marvell.com> In-Reply-To: From: Andrew Pinski Date: Fri, 25 Aug 2023 16:11:51 -0700 Message-ID: Subject: Re: [PATCH 3/3] PHIOPT: Allow BIT_AND and BIT_IOR in early phiopt To: Richard Biener Cc: Andrew Pinski , gcc-patches@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP 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 Thu, Aug 24, 2023 at 11:47=E2=80=AFPM Richard Biener via Gcc-patches wrote: > > On Thu, Aug 24, 2023 at 9:16=E2=80=AFPM Andrew Pinski via Gcc-patches > wrote: > > > > Now that MIN/MAX can sometimes be transformed into BIT_AND/BIT_IOR, > > we should allow BIT_AND and BIT_IOR in the early phiopt. > > Also we produce BIT_AND/BIT_IOR for things like `bool0 ? bool1 : 0` > > which seems like a good thing to allow early on too. > > Hum. > > I think if we allow AND/IOR we should also allow XOR and NOT. Yes, XOR and NOT most likely should be added too. Maybe even comparisons without a conversion too. > > Can you add dumping for replacements we disallow? I'm esp. curious > for those otherwise being "singleton". I know when doing early phiopt > I wanted to be very conservative (also to reduce testsuite fallout), and > I was mostly interested in MIN/MAX which I then extended to similar > things like ABS. But maybe we can revisit this if we understand which > cases we definitely do not want to do early? I have a patch which prints out the dumping of the result and will submit it later today. In the next couple of days I will look into the dump when compiling GCC to see if there are others that seem fine. It might be the case where we want to reject only non single statement ones (except for MIN/MAX were allowing 2 there too). Thanks, Andrew > > > OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. > > > > gcc/ChangeLog: > > > > * tree-ssa-phiopt.cc (phiopt_early_allow): Allow > > BIT_AND_EXPR and BIT_IOR_EXPR. > > --- > > gcc/tree-ssa-phiopt.cc | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc > > index 54706f4c7e7..7e63fb115db 100644 > > --- a/gcc/tree-ssa-phiopt.cc > > +++ b/gcc/tree-ssa-phiopt.cc > > @@ -469,6 +469,9 @@ phiopt_early_allow (gimple_seq &seq, gimple_match_o= p &op) > > { > > case MIN_EXPR: > > case MAX_EXPR: > > + /* MIN/MAX could be convert into these. */ > > + case BIT_IOR_EXPR: > > + case BIT_AND_EXPR: > > case ABS_EXPR: > > case ABSU_EXPR: > > case NEGATE_EXPR: > > -- > > 2.31.1 > >