[llvm-dev] Question about __builtin_assume()

Philip Reames via llvm-dev llvm-dev at lists.llvm.org
Tue Dec 22 15:52:23 PST 2015


It looks like we've never added V % C == C2 in 
computeKnownBitsFromAssume.  This would be a simple patch to add if 
you're interested in fixing the compiler to handle this case.

You might also get this to work by using N & 0x1 == 0.  It looks like we 
do handle that case.  If that doesn't work, it probably means the 
vectorizer isn't asking the right questions here.

Philip

On 12/22/2015 02:34 PM, Mark Schimmel via llvm-dev wrote:
>
> void test_copy_vec(const short* restrict src, short* restrict res, int 
> N) {
>
>  __builtin_assume( (N > 1) && (N%2 == 0) );
>
>   #pragma clang loop vectorize(enable) vectorize_width(2) 
> interleave_count(1)
>
>   for (int j=0; j<N; ++j)
>
>     *res++ = *src++;
>
> }
>
> If I use __builtin_assume(N>1) then llvm knows the loop will execute 
> and not check for (j <= 0), but I can’t seem to get it to accept N is 
> even. Is there a way to get llvm to vectorize the loop and not 
> generate the additional scalar loop conditions?
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151222/ed86362f/attachment.html>


More information about the llvm-dev mailing list