summaryrefslogtreecommitdiff
path: root/lib/Target/X86/X86ISelLowering.cpp
diff options
context:
space:
mode:
authorShuxin Yang <shuxin.llvm@gmail.com>2012-12-09 03:12:46 +0000
committerShuxin Yang <shuxin.llvm@gmail.com>2012-12-09 03:12:46 +0000
commit5518a1355b8b09bf92419b65ea4e4854734b0ebc (patch)
tree65b45feeb37acada71ab18f03a9f5b358272e3e7 /lib/Target/X86/X86ISelLowering.cpp
parent9472b4fbf96fb840eb416acd00bbee173c62e8da (diff)
downloadllvm-5518a1355b8b09bf92419b65ea4e4854734b0ebc.tar.gz
llvm-5518a1355b8b09bf92419b65ea4e4854734b0ebc.tar.bz2
llvm-5518a1355b8b09bf92419b65ea4e4854734b0ebc.tar.xz
- Re-enable population count loop idiom recognization
- fix a bug which cause sigfault. - add two testing cases which was causing crash git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169687 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86ISelLowering.cpp')
-rw-r--r--lib/Target/X86/X86ISelLowering.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp
index af772ed7a3..84e5677d6c 100644
--- a/lib/Target/X86/X86ISelLowering.cpp
+++ b/lib/Target/X86/X86ISelLowering.cpp
@@ -17679,6 +17679,17 @@ FindInConvertTable(const X86TypeConversionCostTblEntry *Tbl, unsigned len,
return -1;
}
+ScalarTargetTransformInfo::PopcntHwSupport
+X86ScalarTargetTransformImpl::getPopcntHwSupport(unsigned TyWidth) const {
+ assert(isPowerOf2_32(TyWidth) && "Ty width must be power of 2");
+ const X86Subtarget &ST = TLI->getTargetMachine().getSubtarget<X86Subtarget>();
+
+ // TODO: Currently the __builtin_popcount() implementation using SSE3
+ // instructions is inefficient. Once the problem is fixed, we should
+ // call ST.hasSSE3() instead of ST.hasSSE4().
+ return ST.hasSSE41() ? Fast : None;
+}
+
unsigned
X86VectorTargetTransformInfo::getArithmeticInstrCost(unsigned Opcode,
Type *Ty) const {