public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "tnfchris at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/108583] [13 Regression] wrong code with vector division by uint16 at -O2
Date: Tue, 31 Jan 2023 11:58:07 +0000	[thread overview]
Message-ID: <bug-108583-4-DEF3HgAoXD@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-108583-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108583

--- Comment #12 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
(In reply to rguenther@suse.de from comment #11)
> On Tue, 31 Jan 2023, tnfchris at gcc dot gnu.org wrote:
> 
> 
> I don't think passing in for example the tree operand 0 helps, the
> target appearantly wants to not specialize by the constant divided by
> but instead also by the number divided (of we already know its type).
> 

The target wants to specialize division by a specific constant.  It just
happens that there is an additional specialization when certain bits are known
to be free in operand0.

> Do you plan to do SSA def pattern matching in the hook for this at
> expand time?
> 

My intention was to only look if the DEF_STMT is a gimple assign, and then the
operands to it are half the precision of the result.  This catches *w, *>> and
any other case.  It doesn't need to know further up because it's harder to
track non-zero bits across different math operations.  and this is enough for
the use case we're interested in.

> As said, recognizing the special case and open-coding the full divison
> in the vectorizer (or possibly even from RTL expansion) would be
> another option here.

open-coding in the vectorizer will require 4 new IFNs and 4 new optabs as it
requires 4 different instructions. 2 for neon, 2 for SVE, which are
semantically different as permutes work different across SVE and NEON.  So if
you're happy with that I will do that.

> (or possibly even from RTL expansion) would be another option here.

I don't really follow this one. The open coding at expand time is what I was
trying to do before.  The issue is there's no longer a single statement if we
don't stop the vectorizer from decomposing it into shifts and multiplies.

As long as the vectorizer does this decomposition there's not much to do at
expand time.  Additionally the number of widening operations after
vectorization is large. So to semantically match them with the decomposed shift
seems impossible..

But those are only my thoughts :) ultimately I'll do the approach you two want.
 If you want me to revert to using IFNs I can do that.

  parent reply	other threads:[~2023-01-31 11:58 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-28 14:00 [Bug rtl-optimization/108583] New: " zsojka at seznam dot cz
2023-01-30  4:19 ` [Bug target/108583] " pinskia at gcc dot gnu.org
2023-01-30  4:22 ` pinskia at gcc dot gnu.org
2023-01-30  8:31 ` rguenth at gcc dot gnu.org
2023-01-30 14:20 ` tnfchris at gcc dot gnu.org
2023-01-30 14:52 ` rguenther at suse dot de
2023-01-30 15:01 ` tnfchris at gcc dot gnu.org
2023-01-30 16:52 ` rsandifo at gcc dot gnu.org
2023-01-30 17:04 ` tnfchris at gcc dot gnu.org
2023-01-31 10:31 ` rguenth at gcc dot gnu.org
2023-01-31 11:01 ` rsandifo at gcc dot gnu.org
2023-01-31 11:39 ` tnfchris at gcc dot gnu.org
2023-01-31 11:44 ` rguenther at suse dot de
2023-01-31 11:58 ` tnfchris at gcc dot gnu.org [this message]
2023-01-31 12:03 ` rsandifo at gcc dot gnu.org
2023-01-31 12:19 ` rguenther at suse dot de
2023-01-31 13:35 ` tnfchris at gcc dot gnu.org
2023-01-31 14:33 ` rguenther at suse dot de
2023-01-31 14:45 ` rguenther at suse dot de
2023-01-31 15:01 ` tnfchris at gcc dot gnu.org
2023-02-01  7:29 ` rguenther at suse dot de
2023-02-01 16:22 ` tnfchris at gcc dot gnu.org
2023-02-02  8:03 ` tnfchris at gcc dot gnu.org
2023-02-02  8:50 ` rguenther at suse dot de
2023-02-02  8:55 ` tnfchris at gcc dot gnu.org
2023-02-08 13:57 ` tnfchris at gcc dot gnu.org
2023-02-09  7:41 ` rguenther at suse dot de
2023-03-12 18:43 ` cvs-commit at gcc dot gnu.org
2023-03-12 18:43 ` cvs-commit at gcc dot gnu.org
2023-03-12 18:43 ` cvs-commit at gcc dot gnu.org
2023-03-12 18:44 ` cvs-commit at gcc dot gnu.org
2023-03-12 18:44 ` cvs-commit at gcc dot gnu.org
2023-03-12 18:45 ` tnfchris at gcc dot gnu.org

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=bug-108583-4-DEF3HgAoXD@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).