OSDN Git Service

X86 CodeGenPrep: sink shufflevectors before shifts
authorTim Northover <tnorthover@apple.com>
Wed, 19 Feb 2014 10:02:43 +0000 (10:02 +0000)
committerTim Northover <tnorthover@apple.com>
Wed, 19 Feb 2014 10:02:43 +0000 (10:02 +0000)
commit44697f3fc1c81644aedadf5e879fed7ff56a03da
tree63d1b192dfd091c63c6d8f9babd5b34873ab367d
parent84d5a235fdd09b7ed5271203a0b4ac9ab657edab
X86 CodeGenPrep: sink shufflevectors before shifts

On x86, shifting a vector by a scalar is significantly cheaper than shifting a
vector by another fully general vector. Unfortunately, because SelectionDAG
operates on just one basic block at a time, the shufflevector instruction that
reveals whether the right-hand side of a shift *is* really a scalar is often
not visible to CodeGen when it's needed.

This adds another handler to CodeGenPrepare, to sink any useful shufflevector
instructions down to the basic block where they're used, predicated on a target
hook (since on other architectures, doing so will often just introduce extra
real work).

rdar://problem/16063505

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201655 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Target/TargetLowering.h
lib/Target/X86/X86ISelLowering.cpp
lib/Target/X86/X86ISelLowering.h
lib/Transforms/Scalar/CodeGenPrepare.cpp
test/Transforms/CodeGenPrepare/x86-shuffle-sink.ll [new file with mode: 0644]