This is an archive of the discontinued LLVM Phabricator instance.

Allow vectorization of few missed llvm intrinsic calls in BBVectorizor
ClosedPublic

Authored by karthikthecool on Apr 23 2014, 4:18 AM.

Details

Summary

Hi Hal,
I'm currently going through and trying to understand BB Vectorizer while doing so i found that few llvm intrinsic function calls which can be vectorized are missed in the switch case of isVectorizableIntrinsic as a result these intrinsic functions are not getting vectorized. This patch modifies isVectorizableIntrinsic function and covers these intrinsic functions in the switch case so that they get vectorized.
Does this patch look good to commit?
Thanks
Karthik Bhat

Diff Detail

Event Timeline

karthikthecool retitled this revision from to Allow vectorization of few missed llvm intrinsic calls in BBVectorizor.
karthikthecool updated this object.
karthikthecool edited the test plan for this revision. (Show Details)
karthikthecool added a reviewer: hfinkel.
karthikthecool added a subscriber: Unknown Object (MLST).

I think bswap can also be vectorized on some architectures?

-eric

Hi Eric,
Yes i think we can vectorize bswap as well as other bitmap manipulation intrinsics such as cttz,ctlz etc. But i think these cannot be classified as VectorizeMath as this flag is for floating-point math intrinsics.
To handle bitmap manipulation intrinsics (e.g. bsap,cttz,ctlz) we might have to add a new flag and support to enable/disable it from command line in BB Vectorizor.
Some flag like *VectorizeBitManipulations* and a command line support to enable/disable it such as -

static cl::opt<bool>
  NoBitManipulation("bb-vectorize-no-bitmanip", cl::init(false), cl::Hidden,
  cl::desc("Don't try to vectorize BitManipulation intrinsics"));

Does it look like the correct approach? I will update the patch to support bitmap manipulation intrinsics if you feel this approach is ok.

Thanks
Karthik Bhat

hfinkel edited edge metadata.Apr 23 2014, 11:44 PM

LGTM, thanks!

Please feel free to submit a follow-up patch for the bit intrinsics.

karthikthecool accepted this revision.Apr 24 2014, 12:38 AM
karthikthecool added a reviewer: karthikthecool.

Thanks Hal, Committed as r207085.
Hal,Eric i will shortly follow up with a patch vectorizing bit intrinsics.
Thanks
Karthik Bhat

This revision is now accepted and ready to land.Apr 24 2014, 12:38 AM

Awesome. Thanks!

-eric