This is an archive of the discontinued LLVM Phabricator instance.

Improve SLP code snippet
ClosedPublic

Authored by lsandov1 on Nov 29 2019, 12:41 PM.

Details

Summary

New C code snippet is more viable for SLP vectorization in most architectures.

Diff Detail

Event Timeline

lsandov1 created this revision.Nov 29 2019, 12:41 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 29 2019, 12:41 PM
spatel added inline comments.Dec 2 2019, 8:34 AM
llvm/docs/Vectorizers.rst
421–424

I understand that integer division is a poor example for vectorization because most targets can't handle it.
But what is the intent of changing 'int' to 'long' in this example? That change appears to prevent vectorization (for most x86 targets at least).

lsandov1 marked an inline comment as done.Dec 5 2019, 9:09 AM
lsandov1 added inline comments.
llvm/docs/Vectorizers.rst
421–424

I was biased by AVX2 in my example (4 longs fits a ymm register) but agree that 'int' is less intrusive and more generic for the proposed code snippet. I will change it.

lsandov1 updated this revision to Diff 232385.Dec 5 2019, 10:24 AM

s/long/int as suggested by @spatel

spatel accepted this revision.Dec 5 2019, 10:37 AM

LGTM - this is definitely better than division, but it might be better yet to have a simpler example and show how it translates to IR.

This revision is now accepted and ready to land.Dec 5 2019, 10:37 AM

@spatel please commit this change on my behalf. This is my first patch and I still do not have write access to the repo. Thanks

This revision was automatically updated to reflect the committed changes.