[x86, InstCombine] transform x86 AVX masked stores to LLVM intrinsics
authorSanjay Patel <spatel@rotateright.com>
Fri, 26 Feb 2016 21:04:14 +0000 (21:04 +0000)
committerSanjay Patel <spatel@rotateright.com>
Fri, 26 Feb 2016 21:04:14 +0000 (21:04 +0000)
commit1ace99351fdf034af94bf6a67aee8b3bb5d96083
treead21397b20f5e2752d1450e9fcb994f56358298a
parent2eff7f788a9e4d71044fcd73c6b391ca31689361
[x86, InstCombine] transform x86 AVX masked stores 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 store mask is constant:

void mstore_zero_mask(float *f, __m128 v) {
  _mm_maskstore_ps(f, _mm_set1_epi32(0), v);
}

void mstore_fake_ones_mask(float *f, __m128 v) {
  _mm_maskstore_ps(f, _mm_set1_epi32(1), v);
}

void mstore_ones_mask(float *f, __m128 v) {
  _mm_maskstore_ps(f, _mm_set1_epi32(0x80000000), v);
}

void mstore_one_set_elt_mask(float *f, __m128 v) {
  _mm_maskstore_ps(f, _mm_set_epi32(0x80000000, 0, 0, 0), v);
}

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

Differential Revision: http://reviews.llvm.org/D17485

llvm-svn: 262064
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
llvm/test/Transforms/InstCombine/x86-masked-memops.ll [new file with mode: 0644]