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.

Reply via email to