Teach VMCore to constant fold shufflevectors with constant operands.
authorChris Lattner <sabre@nondot.org>
Tue, 11 Dec 2007 07:49:37 +0000 (07:49 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 11 Dec 2007 07:49:37 +0000 (07:49 +0000)
commit7431c2ba79cbf7019aafac2ebafa259621726be2
tree0a22bdc9b4944b7bd215ae812c8bca6fb3b676e2
parent1afab9c1e0ae2d145ce01718aa14065393117e70
Teach VMCore to constant fold shufflevectors with constant operands.
This allows us to compile:

#include <emmintrin.h>
typedef __m128i VSInt16;
typedef short vSInt16 __attribute__ ((__vector_size__ (16)));
VSInt16 t3() {
  return (VSInt16)((vSInt16)_mm_set1_epi16(6518));
}

into:

_t3:
movaps LCPI1_0, %xmm0
ret

instead of:
_t3:
movl $6518, %eax
movd %eax, %xmm0
pextrw $0, %xmm0, %eax
xorps %xmm0, %xmm0
pinsrw $0, %eax, %xmm0
punpcklwd %xmm0, %xmm0
pshufd $0, %xmm0, %xmm0
ret

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44856 91177308-0d34-0410-b5e6-96231b3b80d8
lib/VMCore/ConstantFold.cpp