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

--- Comment #5 from Kewen Lin <linkw at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #3)
> On x86 we even have
> 
>   Vector cost: 136
>   Scalar cost: 196
> 
> note that we seem to vectorize the reduction but that only happens with
> -ffast-math, not -O2 -ftree-slp-vectorize?
> 

I don't quite follow this question, may misunderstand it. Yes, -ffast-math is
required, now -O2 doesn't implicitly enable vectorization, it needs the
explicit slp option.

> One issue is the association of
> 
> (diffa * vdw_d * (1 / 6.) + vdw_c * (1 / 4.)) * diffa + vdw_b * (1 / 2.)) *
> diffa + vdw_a
> 
> which we fail to reduce as
> 
>  diffa*diffa*diffa*(1/6.)*vdw_d + diffa*diffa*(1/4.)*vdw_c +
> diffa*(1/2.)*vdw_b + 1.0*vdw_a

Good point!

Reply via email to