[PATCH] Improve Cost model for SLPVectorizer when we have a vector division by power of 2

Sanjay Patel spatel at rotateright.com
Thu Aug 21 10:39:36 PDT 2014


>On Thu, Aug 21, 2014 at 11:16 AM, Andrea Di Biagio <andrea.dibiagio at gmail.com> wrote:
>
>I think it makes perfect sense :-).
>I have a (maybe stupid) question: do we really have to worry about the
>case of UDIV by powers-of-2 in the vectorizer?
>I am asking this because the optimizer would always convert an UDIV by
>powers-of-2 into a SRL. So, by the time we run the vectorizer, all the
>foldable UDIV by power-of-2 have been already optimized into SRL..>

That's an excellent question...
I converted both of the current test cases in the patch to 'udiv', and we already get vectorized 'lshr' with opt -O2. :)

Whether we need extra code down in TargetTransformInfo for UDIV as a safeguard, I don't know.

http://reviews.llvm.org/D4971






More information about the llvm-commits mailing list