handle the constant case of vector insertion. For something
commite3b9d0c2e9e8a080812ab95589b2c638775e3265
authorChris Lattner <sabre@nondot.org>
Sat, 28 Aug 2010 01:50:57 +0000 (28 01:50 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 28 Aug 2010 01:50:57 +0000 (28 01:50 +0000)
treee4f0468292791a54fcb33cdcf1c6d38f8e5c1773
parentd6145f1f98b2f7957b49130693489f693443cbd2
handle the constant case of vector insertion.  For something
like this:

struct S { float A, B, C, D; };

struct S g;
struct S bar() {
  struct S A = g;
  ++A.B;
  A.A = 42;
  return A;
}

we now generate:

_bar:                                   ## @bar
## BB#0:                                ## %entry
movq _g@GOTPCREL(%rip), %rax
movss 12(%rax), %xmm0
pshufd $16, %xmm0, %xmm0
movss 4(%rax), %xmm2
movss 8(%rax), %xmm1
pshufd $16, %xmm1, %xmm1
unpcklps %xmm0, %xmm1
addss LCPI1_0(%rip), %xmm2
pshufd $16, %xmm2, %xmm2
movss LCPI1_1(%rip), %xmm0
pshufd $16, %xmm0, %xmm0
unpcklps %xmm2, %xmm0
ret

instead of:

_bar:                                   ## @bar
## BB#0:                                ## %entry
movq _g@GOTPCREL(%rip), %rax
movss 12(%rax), %xmm0
pshufd $16, %xmm0, %xmm0
movss 4(%rax), %xmm2
movss 8(%rax), %xmm1
pshufd $16, %xmm1, %xmm1
unpcklps %xmm0, %xmm1
addss LCPI1_0(%rip), %xmm2
movd %xmm2, %eax
shlq $32, %rax
addq $1109917696, %rax       ## imm = 0x42280000
movd %rax, %xmm0
ret

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112345 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineCasts.cpp
test/Transforms/InstCombine/bitcast.ll