[llvm] r201222 - R600: Always implement both versions of isTruncateFree and add a sanity check.
Benjamin Kramer
benny.kra at googlemail.com
Wed Feb 12 02:17:55 PST 2014
Author: d0k
Date: Wed Feb 12 04:17:54 2014
New Revision: 201222
URL: http://llvm.org/viewvc/llvm-project?rev=201222&view=rev
Log:
R600: Always implement both versions of isTruncateFree and add a sanity check.
Modified:
llvm/trunk/lib/Target/R600/AMDGPUISelLowering.cpp
llvm/trunk/lib/Target/R600/AMDGPUISelLowering.h
Modified: llvm/trunk/lib/Target/R600/AMDGPUISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/R600/AMDGPUISelLowering.cpp?rev=201222&r1=201221&r2=201222&view=diff
==============================================================================
--- llvm/trunk/lib/Target/R600/AMDGPUISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/R600/AMDGPUISelLowering.cpp Wed Feb 12 04:17:54 2014
@@ -232,9 +232,15 @@ bool AMDGPUTargetLowering::isFNegFree(EV
return VT == MVT::f32;
}
-bool AMDGPUTargetLowering::isTruncateFree(EVT, EVT Dest) const {
+bool AMDGPUTargetLowering::isTruncateFree(EVT Source, EVT Dest) const {
// Truncate is just accessing a subregister.
- return (Dest.getSizeInBits() % 32 == 0);
+ return Dest.bitsLT(Source) && (Dest.getSizeInBits() % 32 == 0);
+}
+
+bool AMDGPUTargetLowering::isTruncateFree(Type *Source, Type *Dest) const {
+ // Truncate is just accessing a subregister.
+ return Dest->getPrimitiveSizeInBits() < Source->getPrimitiveSizeInBits() &&
+ (Dest->getPrimitiveSizeInBits() % 32 == 0);
}
//===---------------------------------------------------------------------===//
Modified: llvm/trunk/lib/Target/R600/AMDGPUISelLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/R600/AMDGPUISelLowering.h?rev=201222&r1=201221&r2=201222&view=diff
==============================================================================
--- llvm/trunk/lib/Target/R600/AMDGPUISelLowering.h (original)
+++ llvm/trunk/lib/Target/R600/AMDGPUISelLowering.h Wed Feb 12 04:17:54 2014
@@ -79,10 +79,11 @@ protected:
public:
AMDGPUTargetLowering(TargetMachine &TM);
- virtual bool isFAbsFree(EVT VT) const;
- virtual bool isFNegFree(EVT VT) const;
+ virtual bool isFAbsFree(EVT VT) const LLVM_OVERRIDE;
+ virtual bool isFNegFree(EVT VT) const LLVM_OVERRIDE;
virtual bool isTruncateFree(EVT Src, EVT Dest) const LLVM_OVERRIDE;
- virtual MVT getVectorIdxTy() const;
+ virtual bool isTruncateFree(Type *Src, Type *Dest) const LLVM_OVERRIDE;
+ virtual MVT getVectorIdxTy() const LLVM_OVERRIDE;
virtual bool isLoadBitCastBeneficial(EVT, EVT) const LLVM_OVERRIDE;
virtual SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv,
bool isVarArg,
More information about the llvm-commits
mailing list