diff options
author | Tim Northover <tnorthover@apple.com> | 2014-02-19 10:02:43 +0000 |
---|---|---|
committer | Tim Northover <tnorthover@apple.com> | 2014-02-19 10:02:43 +0000 |
commit | 44697f3fc1c81644aedadf5e879fed7ff56a03da (patch) | |
tree | 63d1b192dfd091c63c6d8f9babd5b34873ab367d /include/llvm | |
parent | 84d5a235fdd09b7ed5271203a0b4ac9ab657edab (diff) | |
download | llvm-44697f3fc1c81644aedadf5e879fed7ff56a03da.tar.gz llvm-44697f3fc1c81644aedadf5e879fed7ff56a03da.tar.bz2 llvm-44697f3fc1c81644aedadf5e879fed7ff56a03da.tar.xz |
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
Diffstat (limited to 'include/llvm')
-rw-r--r-- | include/llvm/Target/TargetLowering.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/llvm/Target/TargetLowering.h b/include/llvm/Target/TargetLowering.h index 155bb0a7a5..0b3428ed7a 100644 --- a/include/llvm/Target/TargetLowering.h +++ b/include/llvm/Target/TargetLowering.h @@ -1185,6 +1185,14 @@ public: return true; } + /// Return true if it's significantly cheaper to shift a vector by a uniform + /// scalar than by an amount which will vary across each lane. On x86, for + /// example, there is a "psllw" instruction for the former case, but no simple + /// instruction for a general "a << b" operation on vectors. + virtual bool isVectorShiftByScalarCheap(Type *Ty) const { + return false; + } + /// Return true if it's free to truncate a value of type Ty1 to type /// Ty2. e.g. On x86 it's free to truncate a i32 value in register EAX to i16 /// by referencing its sub-register AX. |