[llvm-dev] Question about __builtin_assume()
Mark Schimmel via llvm-dev
llvm-dev at lists.llvm.org
Tue Dec 22 14:34:41 PST 2015
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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151222/0cf5f831/attachment.html>
More information about the llvm-dev
mailing list