From: Benjamin Kramer Date: Wed, 12 Feb 2014 10:17:54 +0000 (+0000) Subject: R600: Always implement both versions of isTruncateFree and add a sanity check. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=eee40f92a9094f77514a417a3c727fb24e19bf96;p=oota-llvm.git R600: Always implement both versions of isTruncateFree and add a sanity check. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201222 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/R600/AMDGPUISelLowering.cpp b/lib/Target/R600/AMDGPUISelLowering.cpp index 1df02d3f987..c67ac1c11cf 100644 --- a/lib/Target/R600/AMDGPUISelLowering.cpp +++ b/lib/Target/R600/AMDGPUISelLowering.cpp @@ -232,9 +232,15 @@ bool AMDGPUTargetLowering::isFNegFree(EVT VT) const { 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); } //===---------------------------------------------------------------------===// diff --git a/lib/Target/R600/AMDGPUISelLowering.h b/lib/Target/R600/AMDGPUISelLowering.h index 311959e682b..b53ba0a542f 100644 --- a/lib/Target/R600/AMDGPUISelLowering.h +++ b/lib/Target/R600/AMDGPUISelLowering.h @@ -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,