diff options
author | Pierre Gousseau <pierregousseau14@gmail.com> | 2016-10-14 16:41:38 +0000 |
---|---|---|
committer | Pierre Gousseau <pierregousseau14@gmail.com> | 2016-10-14 16:41:38 +0000 |
commit | b6d652adb5b12b7d1fc7e973a5afc019875cb547 (patch) | |
tree | a8196cccb70b3ebb8eba63d17f04efa2f7f31fde /llvm/lib/Target/X86/X86Subtarget.cpp | |
parent | 6d6eca5cdc995fdb8850fd5c79d1018893a44988 (diff) | |
download | bcm5719-llvm-b6d652adb5b12b7d1fc7e973a5afc019875cb547.tar.gz bcm5719-llvm-b6d652adb5b12b7d1fc7e973a5afc019875cb547.zip |
[X86] Take advantage of the lzcnt instruction on btver2 architectures when ORing comparisons to zero.
This change adds transformations such as:
zext(or(setcc(eq, (cmp x, 0)), setcc(eq, (cmp y, 0))))
To:
srl(or(ctlz(x), ctlz(y)), log2(bitsize(x))
This optimisation is beneficial on Jaguar architecture only, where lzcnt has a good reciprocal throughput.
Other architectures such as Intel's Haswell/Broadwell or AMD's Bulldozer/PileDriver do not benefit from it.
For this reason the change also adds a "HasFastLZCNT" feature which gets enabled for Jaguar.
Differential Revision: https://reviews.llvm.org/D23446
llvm-svn: 284248
Diffstat (limited to 'llvm/lib/Target/X86/X86Subtarget.cpp')
-rw-r--r-- | llvm/lib/Target/X86/X86Subtarget.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/X86Subtarget.cpp b/llvm/lib/Target/X86/X86Subtarget.cpp index 156c0b99a2b..91fdc5afe8a 100644 --- a/llvm/lib/Target/X86/X86Subtarget.cpp +++ b/llvm/lib/Target/X86/X86Subtarget.cpp @@ -284,6 +284,7 @@ void X86Subtarget::initializeEnvironment() { HasFastPartialYMMWrite = false; HasFastScalarFSQRT = false; HasFastVectorFSQRT = false; + HasFastLZCNT = false; HasSlowDivide32 = false; HasSlowDivide64 = false; PadShortFunctions = false; |