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 tree-optimization/51492] vectorizer does not support saturated arithmetic patterns
Date: Thu, 01 Feb 2024 15:10:55 +0000	[thread overview]
Message-ID: <bug-51492-4-bryvG6Tsgc@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-51492-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #12 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
(In reply to JuzheZhong from comment #11)
> Hi, Tamar.
> 
> We are interested in supporting saturating and rounding.

Awesome!

> 
> We may need to support scalar first.
> 
> Do you have any suggestions ?
> 
> Or you are already working on it?

No, atm we're not, it's on the backlog but haven't gotten to it so feel free to
do so.

The general conclusion of the thread is that we should introduce new internal
functions in the mid-end for this (also see
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112600 for some other scalar
examples).

So e.g. we'd have IFN_SAT_ADD etc and new optabs.  recognizing this on scalar
you'll then automatically get autovect.

What I would do is create non-direct-optab IFNs.  as in, have a default
fallback for architectures that don't have the optab implemented, and those
that do use the optab.

I think we should be able to do better here in general even for scalar if we
know the operation is supposed to saturate like
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112600 shows.

This also simplifies optimizations because every target then has the same
GIMPLE representation for these operations.

The only outstanding thing is where to do this.  We obviously have to do so
before vectorization but some of the saturation idioms require phi-opts
https://godbolt.org/z/9oWP5vqee but others can't be done in phi-opts, those
probably fit in match.pd or forwardprop.

Any suggestions of where to best add the detection richi?


> 
> Thanks.

  parent reply	other threads:[~2024-02-01 15:10 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-10  1:38 [Bug tree-optimization/51492] New: vectorizer generates unnecessary code drepper.fsp at gmail dot com
2011-12-12 10:25 ` [Bug tree-optimization/51492] vectorizer does not support saturated arithmetic patterns rguenth at gcc dot gnu.org
2012-01-08 18:57 ` drepper.fsp at gmail dot com
2012-07-13  8:39 ` rguenth at gcc dot gnu.org
2021-08-24 23:44 ` pinskia at gcc dot gnu.org
2021-08-25  3:54 ` pinskia at gcc dot gnu.org
2024-02-01 13:06 ` pan2.li at intel dot com
2024-02-01 13:37 ` juzhe.zhong at rivai dot ai
2024-02-01 13:42 ` juzhe.zhong at rivai dot ai
2024-02-01 14:40 ` juzhe.zhong at rivai dot ai
2024-02-01 14:41 ` juzhe.zhong at rivai dot ai
2024-02-01 15:10 ` tnfchris at gcc dot gnu.org [this message]
2024-02-02  1:04 ` pan2.li at intel dot com
2024-02-02 11:11 ` tnfchris at gcc dot gnu.org
2024-02-03  6:57 ` pan2.li at intel dot com
2024-02-06  1:13 ` pan2.li at intel dot com
2024-02-06 22:11 ` tnfchris at gcc dot gnu.org
2024-02-07  0:57 ` pan2.li at intel dot com
2024-05-16 12:09 ` cvs-commit at gcc dot gnu.org
2024-05-16 12:09 ` cvs-commit at gcc dot gnu.org
2024-05-18  2:17 ` cvs-commit 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-51492-4-bryvG6Tsgc@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).