--- Comment #6 from morandidodo at gmail dot com ---
(In reply to Richard Biener from comment #1)
> First of all you need to make sure to have recent glibc installed to benefit
> from
> the vectorized math routines therein.  Otherwise we cannot vectorize
> std::log.
> Second, I think the if (i == 0) needs loop splitting (patch pending, author
> CCed).
> If you re-write the loop to
>   if (s != 0)
>     a[i] = b[i] * c[i];
>   for (unsigned i = 1; i < s; ++i)
>     a[i] = (b[i] + c[i]) * c[i-1] * std::log(i);
> then GCC will be able to vectorize it.  Confirmed because of that issue.

I can confirm the glibc is the last one (I use Arch Linux, it generally has the
last version of different software).

I know that, in this case, the condition inside the loop can be easily avoided,
but it is not the case when the checked value depends on an array.

However, I just made some tests, and it seems that the performance lost is
particularly related to std::log. If something else is being used, like
std::sqrt for example, the code compiled with gcc is still slower, but less.

Reply via email to