[PATCH] R600: Implement isTruncateFree

Tom Stellard tom at stellard.net
Mon Feb 10 08:24:20 PST 2014


On Fri, Feb 07, 2014 at 08:18:37PM -0800, Matt Arsenault wrote:
> Truncation is just accessing a subregister for any multiple of the register size, so it's free.
> 

LGTM.

> 
> http://llvm-reviews.chandlerc.com/D2725
> 
> Files:
>   lib/Target/R600/AMDGPUISelLowering.cpp
>   lib/Target/R600/AMDGPUISelLowering.h
> 
> Index: lib/Target/R600/AMDGPUISelLowering.cpp
> ===================================================================
> --- lib/Target/R600/AMDGPUISelLowering.cpp
> +++ lib/Target/R600/AMDGPUISelLowering.cpp
> @@ -234,6 +234,11 @@
>    return VT == MVT::f32;
>  }
>  
> +bool AMDGPUTargetLowering::isTruncateFree(EVT, EVT Dest) const {
> +  // Truncate is just access a subregister.
> +  return (Dest.getSizeInBits() % 32 == 0);
> +}
> +
>  //===---------------------------------------------------------------------===//
>  // TargetLowering Callbacks
>  //===---------------------------------------------------------------------===//
> Index: lib/Target/R600/AMDGPUISelLowering.h
> ===================================================================
> --- lib/Target/R600/AMDGPUISelLowering.h
> +++ lib/Target/R600/AMDGPUISelLowering.h
> @@ -85,6 +85,7 @@
>  
>    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,

> Index: lib/Target/R600/AMDGPUISelLowering.cpp
> ===================================================================
> --- lib/Target/R600/AMDGPUISelLowering.cpp
> +++ lib/Target/R600/AMDGPUISelLowering.cpp
> @@ -234,6 +234,11 @@
>    return VT == MVT::f32;
>  }
>  
> +bool AMDGPUTargetLowering::isTruncateFree(EVT, EVT Dest) const {
> +  // Truncate is just access a subregister.
> +  return (Dest.getSizeInBits() % 32 == 0);
> +}
> +
>  //===---------------------------------------------------------------------===//
>  // TargetLowering Callbacks
>  //===---------------------------------------------------------------------===//
> Index: lib/Target/R600/AMDGPUISelLowering.h
> ===================================================================
> --- lib/Target/R600/AMDGPUISelLowering.h
> +++ lib/Target/R600/AMDGPUISelLowering.h
> @@ -85,6 +85,7 @@
>  
>    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,

> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list