[X86] Teach how to combine a vselect into a movss/movsd
authorAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Mon, 20 Jan 2014 19:35:22 +0000 (19:35 +0000)
committerAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Mon, 20 Jan 2014 19:35:22 +0000 (19:35 +0000)
commit825b93b2dfb101c8b5e32d6f7199e116d559f625
treea179d49657b0f91c7183d13bc3ba03f0c9db5bb6
parent16d00e4b64ce2d2560f4f7e46517f3ce1e05bdf1
[X86] Teach how to combine a vselect into a movss/movsd

Add target specific rules for combining vselect dag nodes into movss/movsd
when possible.

If the vector type of the vselect dag node in input is either MVT::v4i13 or
MVT::v4f32, then try to fold according to rules:

  1) fold (vselect (build_vector (0, -1, -1, -1)), A, B) -> (movss A, B)
  2) fold (vselect (build_vector (-1, 0, 0, 0)), A, B) -> (movss B, A)

If the vector type of the vselect dag node in input is either MVT::v2i64 or
MVT::v2f64 (and we have SSE2), then try to fold according to rules:

  3) fold (vselect (build_vector (0, -1)), A, B) -> (movsd A, B)
  4) fold (vselect (build_vector (-1, 0)), A, B) -> (movsd B, A)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199683 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/avx-blend.ll
test/CodeGen/X86/blend-msb.ll
test/CodeGen/X86/sse-scalar-fp-arith-2.ll
test/CodeGen/X86/sse2-blend.ll
test/CodeGen/X86/sse41-blend.ll
test/CodeGen/X86/vselect.ll