[x86] avoid intermediate splat for non-zero memsets (PR27100)
authorSanjay Patel <spatel@rotateright.com>
Fri, 1 Apr 2016 16:27:14 +0000 (16:27 +0000)
committerSanjay Patel <spatel@rotateright.com>
Fri, 1 Apr 2016 16:27:14 +0000 (16:27 +0000)
commita05e0ff22376f4cbc6707841b3760c6f9f587663
treeab897aa6ec4036a564b7c9099ae23710bad70a07
parent2ee00920538c0b6e7df75ac0f79f49a97b215f01
[x86] avoid intermediate splat for non-zero memsets (PR27100)

Follow-up to D18566 - where we noticed that an intermediate splat was being
generated for memsets of non-zero chars.

That was because we told getMemsetStores() to use a 32-bit vector element type,
and it happily obliged by producing that constant using an integer multiply.

The tests that were added in the last patch are now equivalent for AVX1 and AVX2
(no splats, just a vector load), but we have PR27141 to track that splat difference.
In the new tests, the splat via shuffling looks ok to me, but there might be some
room for improvement depending on uarch there.

Note that the SSE1/2 paths are not changed in this patch. That can be a follow-up.
This patch should resolve PR27100.

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

llvm-svn: 265148
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/memset-nonzero.ll