public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Richard Biener <rguenther@suse.de>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] match.pd: Fix up sqrt (sqrt (x)) simplification [PR109301]
Date: Tue, 28 Mar 2023 11:15:56 +0200	[thread overview]
Message-ID: <ZCKwTE8cpXMrHLVN@tucnak> (raw)
In-Reply-To: <nycvar.YFH.7.77.849.2303280848070.18795@jbgna.fhfr.qr>

On Tue, Mar 28, 2023 at 08:57:12AM +0000, Richard Biener wrote:
> Hmm, but canonicalize_math_p () should be false after vectorization?
> 
> When we moved the pass we should have made sure to put the
> PROP_gimple_opt_math property set to pass_expand_powcabs instead.

Which pass is the one that actually canonicalizes the math such
that we want to keep its choices for later?
I must say I don't know the details why the sincos path has been
even moved.

> Now, the sqrt (sqrt ()) canonicalization to pow (.., 1./4) is
> probably invalid anyway, not sure if we can add a user-written
> vector sqrt testcase that would trigger during the canonicalization

How do we write user written vector sqrt?

> phase.  There are other uses of build_real that have the same
> issue - what's your conclusion this is never a problem there?

Looking through build_real* calls in match.pd, others are
either on simplifications of some expressions with REAL_CST operand
(so can't be vector then), or using
LOG*/EXP*/CBRT*/SIN*/ATAN*/COS*/POW*/CABS*/HYPOT*/POWI*/SIGNBIT*
calls in the expression being simplified, or this case.
I think no target provides vector optabs for those or they don't
have internal fns at all.
Maybe
(simplify
 /* signbit(x) -> x<0 if x doesn't have signed zeros.  */
 (SIGNBIT @0)
 (if (!HONOR_SIGNED_ZEROS (@0))
  (convert (lt @0 { build_real (TREE_TYPE (@0), dconst0); }))))
?

	Jakub


  reply	other threads:[~2023-03-28  9:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-28  8:25 Jakub Jelinek
2023-03-28  8:57 ` Richard Biener
2023-03-28  9:15   ` Jakub Jelinek [this message]
2023-03-28  9:23     ` Richard Biener
2023-03-28 10:07       ` [PATCH] tree-ssa-math-opts: Move PROP_gimple_opt_math from sincos pass to powcabs [PR109301] Jakub Jelinek
2023-03-28 10:53         ` Richard Biener

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZCKwTE8cpXMrHLVN@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rguenther@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).