diff options
| author | Shuxin Yang <shuxin.llvm@gmail.com> | 2012-12-09 03:12:46 +0000 |
|---|---|---|
| committer | Shuxin Yang <shuxin.llvm@gmail.com> | 2012-12-09 03:12:46 +0000 |
| commit | 95de7c37e286bf85d9111718caf48466eb1ac784 (patch) | |
| tree | 23b45a6055404c0e3bd0ea34216b2d114d1d223f /llvm/lib/Target/X86 | |
| parent | 9f4328b17399d1fc9a0e9b3d646f43f9ce005924 (diff) | |
| download | bcm5719-llvm-95de7c37e286bf85d9111718caf48466eb1ac784.tar.gz bcm5719-llvm-95de7c37e286bf85d9111718caf48466eb1ac784.zip | |
- Re-enable population count loop idiom recognization
- fix a bug which cause sigfault.
- add two testing cases which was causing crash
llvm-svn: 169687
Diffstat (limited to 'llvm/lib/Target/X86')
| -rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.cpp | 11 | ||||
| -rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.h | 8 | ||||
| -rw-r--r-- | llvm/lib/Target/X86/X86TargetMachine.h | 2 |
3 files changed, 20 insertions, 1 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index af772ed7a36..84e5677d6c1 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/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 { diff --git a/llvm/lib/Target/X86/X86ISelLowering.h b/llvm/lib/Target/X86/X86ISelLowering.h index 1fdac340329..1042fe13ec7 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.h +++ b/llvm/lib/Target/X86/X86ISelLowering.h @@ -932,6 +932,14 @@ namespace llvm { const TargetLibraryInfo *libInfo); } + class X86ScalarTargetTransformImpl : public ScalarTargetTransformImpl { + public: + explicit X86ScalarTargetTransformImpl(const TargetLowering *TL) : + ScalarTargetTransformImpl(TL) {}; + + virtual PopcntHwSupport getPopcntHwSupport(unsigned TyWidth) const; + }; + class X86VectorTargetTransformInfo : public VectorTargetTransformImpl { public: explicit X86VectorTargetTransformInfo(const TargetLowering *TL) : diff --git a/llvm/lib/Target/X86/X86TargetMachine.h b/llvm/lib/Target/X86/X86TargetMachine.h index a3de042c9b4..792f721e768 100644 --- a/llvm/lib/Target/X86/X86TargetMachine.h +++ b/llvm/lib/Target/X86/X86TargetMachine.h @@ -118,7 +118,7 @@ class X86_64TargetMachine : public X86TargetMachine { X86SelectionDAGInfo TSInfo; X86TargetLowering TLInfo; X86JITInfo JITInfo; - ScalarTargetTransformImpl STTI; + X86ScalarTargetTransformImpl STTI; X86VectorTargetTransformInfo VTTI; public: X86_64TargetMachine(const Target &T, StringRef TT, |

