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

--- Comment #12 from Matthias Kretz (Vir) <mkretz at gcc dot gnu.org> ---
(In reply to Drea Pinski from comment #10)
> (In reply to Matthias Kretz (Vir) from comment #9)
> > (In reply to Drea Pinski from comment #8)
> > > Does not work for aarch64 so I don't know what you are talking about.
> > 
> > Target: x86_64-*-*
> > 
> > <simd> is currently shipping in an x86-only "preview". Why are we now
> > talking about aarch64?
> 
> Because you should be using GNU vectors here. Anything else is just NOT
> portable.

It does. There's a branch that depends on __SSE2__ and whether the divisor
value is unknown to the optimizer before it uses fp div. So you still get e.g.
shift by 1 for `x / 2`, even on x86.

> My point is I think C++26 simd should be using as much as generic vectors as
> possible first and then optimize for targets.

We're in full agreement here. However, there are situations that are different
from auto-vectorization (this one) and some where the optimizer simply has less
information than the library implementation. In these cases, I believe the
library implementation must consider turning that into better code-gen.

Reply via email to