[x86, InstCombine] transform x86 AVX masked loads to LLVM intrinsics
authorSanjay Patel <spatel@rotateright.com>
Mon, 29 Feb 2016 23:16:48 +0000 (23:16 +0000)
committerSanjay Patel <spatel@rotateright.com>
Mon, 29 Feb 2016 23:16:48 +0000 (23:16 +0000)
commit98a71505f5c2ea56c6cc4c9ccc67f25355cf1d93
tree15e655943b829cfac82ef8098c832b0c2771d136
parentfe2f7f367a09cc5b0330b87c0f0b0078a0700a8f
[x86, InstCombine] transform x86 AVX masked loads to LLVM intrinsics

The intended effect of this patch in conjunction with:
http://reviews.llvm.org/rL259392
http://reviews.llvm.org/rL260145

is that customers using the AVX intrinsics in C will benefit from combines when
the load mask is constant:

__m128 mload_zeros(float *f) {
  return _mm_maskload_ps(f, _mm_set1_epi32(0));
}

__m128 mload_fakeones(float *f) {
  return _mm_maskload_ps(f, _mm_set1_epi32(1));
}

__m128 mload_ones(float *f) {
  return _mm_maskload_ps(f, _mm_set1_epi32(0x80000000));
}

__m128 mload_oneset(float *f) {
  return _mm_maskload_ps(f, _mm_set_epi32(0x80000000, 0, 0, 0));
}

...so none of the above will actually generate a masked load for optimized code.

This is the masked load counterpart to:
http://reviews.llvm.org/rL262064

llvm-svn: 262269
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
llvm/test/Transforms/InstCombine/x86-masked-memops.ll