[llvm] r200576 - [SLPV] Recognize vectorizable intrinsics during SLP vectorization and

Chandler Carruth chandlerc at gmail.com
Tue Feb 4 15:13:30 PST 2014


On Tue, Feb 4, 2014 at 2:42 PM, Raul Silvera <rsilvera at google.com> wrote:

> I had a quick look at the original testcase from Reid, and we're only
> vectorizing in 32-bit mode. The vectorization cost analysis ends up
> deciding that there is a small gain to be had (I believe incorrectly).
>
> The vectorization cost is computed as the cost of the load, bswap and
> store.
> The load and store get cost = -3 each (loading a single v2x64 vs four i32)
> The bswap (including overhead) gets cost 4 (6 vector - 2 scalar).
>
> Total we get cost 4-3-3=-2 so we vectorize (it vectorizes if cost <0).
>
> I think the bug is that the scalarization overhead doesn't take into
> account the cost of legalizing the vector element type, which in this case
> incurs additional costs as it is i64 on 32-bit mode. I have a patch that
> adds the cost of legalizing the element type to
> BasicTTI::getScalarizationOverhead, and it stops this vectorization (we get
> cost 12-3-3=6).
>
> If this sounds OK in principle I can submit a patch for review.
>

This makes sense to me. Folks can comment on the patch in review if there
are cases where this isn't right.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140204/890333b0/attachment.html>


More information about the llvm-commits mailing list