[llvm] r201107 - R600: Implement isTruncateFree

Matt Arsenault Matthew.Arsenault at amd.com
Mon Feb 10 11:57:42 PST 2014


Author: arsenm
Date: Mon Feb 10 13:57:42 2014
New Revision: 201107

URL: http://llvm.org/viewvc/llvm-project?rev=201107&view=rev
Log:
R600: Implement isTruncateFree

Truncation is just accessing a subregister for any multiple of
the register size, so it's free.

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=201107&r1=201106&r2=201107&view=diff
==============================================================================
--- llvm/trunk/lib/Target/R600/AMDGPUISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/R600/AMDGPUISelLowering.cpp Mon Feb 10 13:57:42 2014
@@ -232,6 +232,11 @@ bool AMDGPUTargetLowering::isFNegFree(EV
   return VT == MVT::f32;
 }
 
+bool AMDGPUTargetLowering::isTruncateFree(EVT, EVT Dest) const {
+  // Truncate is just accessing a subregister.
+  return (Dest.getSizeInBits() % 32 == 0);
+}
+
 //===---------------------------------------------------------------------===//
 // TargetLowering Callbacks
 //===---------------------------------------------------------------------===//

Modified: llvm/trunk/lib/Target/R600/AMDGPUISelLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/R600/AMDGPUISelLowering.h?rev=201107&r1=201106&r2=201107&view=diff
==============================================================================
--- llvm/trunk/lib/Target/R600/AMDGPUISelLowering.h (original)
+++ llvm/trunk/lib/Target/R600/AMDGPUISelLowering.h Mon Feb 10 13:57:42 2014
@@ -81,6 +81,7 @@ public:
 
   virtual bool isFAbsFree(EVT VT) const;
   virtual bool isFNegFree(EVT VT) const;
+  virtual bool isTruncateFree(EVT Src, EVT Dest) const LLVM_OVERRIDE;
   virtual MVT getVectorIdxTy() const;
   virtual bool isLoadBitCastBeneficial(EVT, EVT) const LLVM_OVERRIDE;
   virtual SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv,





More information about the llvm-commits mailing list