LLVM 19.0.0git
Macros | Functions
AMDGPUInstCombineIntrinsic.cpp File Reference
#include "AMDGPUInstrInfo.h"
#include "AMDGPUTargetTransformInfo.h"
#include "GCNSubtarget.h"
#include "llvm/ADT/FloatingPointMode.h"
#include "llvm/IR/IntrinsicsAMDGPU.h"
#include "llvm/Transforms/InstCombine/InstCombiner.h"
#include <optional>
#include "InstCombineTables.inc"

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "AMDGPUtti"
 
#define GET_AMDGPUImageDMaskIntrinsicTable_IMPL
 

Functions

static APFloat fmed3AMDGCN (const APFloat &Src0, const APFloat &Src1, const APFloat &Src2)
 
static bool canSafelyConvertTo16Bit (Value &V, bool IsFloat)
 
static ValueconvertTo16Bit (Value &V, InstCombiner::BuilderTy &Builder)
 
static std::optional< Instruction * > modifyIntrinsicCall (IntrinsicInst &OldIntr, Instruction &InstToReplace, unsigned NewIntr, InstCombiner &IC, std::function< void(SmallVectorImpl< Value * > &, SmallVectorImpl< Type * > &)> Func)
 Applies Func(OldIntr.Args, OldIntr.ArgTys), creates intrinsic call with modified arguments (based on OldIntr) and replaces InstToReplace with this newly created intrinsic call.
 
static std::optional< Instruction * > simplifyAMDGCNImageIntrinsic (const GCNSubtarget *ST, const AMDGPU::ImageDimIntrinsicInfo *ImageDimIntr, IntrinsicInst &II, InstCombiner &IC)
 
static bool matchFPExtFromF16 (Value *Arg, Value *&FPExtSrc)
 Match an fpext from half to float, or a constant we can convert.
 
static APInt trimTrailingZerosInVector (InstCombiner &IC, Value *UseV, Instruction *I)
 
static APInt defaultComponentBroadcast (Value *V)
 
static ValuesimplifyAMDGCNMemoryIntrinsicDemanded (InstCombiner &IC, IntrinsicInst &II, APInt DemandedElts, int DMaskIdx, bool IsLoad)
 Implement SimplifyDemandedVectorElts for amdgcn buffer and image intrinsics.
 
static bool canContractSqrtToRsq (const FPMathOperator *SqrtOp)
 Return true if it's legal to contract llvm.amdgcn.rcp(llvm.sqrt)
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "AMDGPUtti"

Definition at line 28 of file AMDGPUInstCombineIntrinsic.cpp.

◆ GET_AMDGPUImageDMaskIntrinsicTable_IMPL

#define GET_AMDGPUImageDMaskIntrinsicTable_IMPL

Definition at line 36 of file AMDGPUInstCombineIntrinsic.cpp.

Function Documentation

◆ canContractSqrtToRsq()

static bool canContractSqrtToRsq ( const FPMathOperator SqrtOp)
static

◆ canSafelyConvertTo16Bit()

static bool canSafelyConvertTo16Bit ( Value V,
bool  IsFloat 
)
static

◆ convertTo16Bit()

static Value * convertTo16Bit ( Value V,
InstCombiner::BuilderTy Builder 
)
static

◆ defaultComponentBroadcast()

static APInt defaultComponentBroadcast ( Value V)
static

◆ fmed3AMDGCN()

static APFloat fmed3AMDGCN ( const APFloat Src0,
const APFloat Src1,
const APFloat Src2 
)
static

◆ matchFPExtFromF16()

static bool matchFPExtFromF16 ( Value Arg,
Value *&  FPExtSrc 
)
static

◆ modifyIntrinsicCall()

static std::optional< Instruction * > modifyIntrinsicCall ( IntrinsicInst OldIntr,
Instruction InstToReplace,
unsigned  NewIntr,
InstCombiner IC,
std::function< void(SmallVectorImpl< Value * > &, SmallVectorImpl< Type * > &)>  Func 
)
static

◆ simplifyAMDGCNImageIntrinsic()

static std::optional< Instruction * > simplifyAMDGCNImageIntrinsic ( const GCNSubtarget ST,
const AMDGPU::ImageDimIntrinsicInfo ImageDimIntr,
IntrinsicInst II,
InstCombiner IC 
)
static

◆ simplifyAMDGCNMemoryIntrinsicDemanded()

static Value * simplifyAMDGCNMemoryIntrinsicDemanded ( InstCombiner IC,
IntrinsicInst II,
APInt  DemandedElts,
int  DMaskIdx,
bool  IsLoad 
)
static

Implement SimplifyDemandedVectorElts for amdgcn buffer and image intrinsics.

The result of simplifying amdgcn image and buffer store intrinsics is updating definitions of the intrinsics vector argument, not Uses of the result like image and buffer loads. Note: This only supports non-TFE/LWE image intrinsic calls; those have struct returns.

Definition at line 1214 of file AMDGPUInstCombineIntrinsic.cpp.

References llvm::CallBase::args(), llvm::InstCombiner::Builder, llvm::Instruction::copyMetadata(), llvm::APInt::countr_zero(), llvm::IRBuilderBase::CreateAdd(), llvm::IRBuilderBase::CreateCall(), llvm::IRBuilderBase::CreateExtractElement(), llvm::IRBuilderBase::CreateInsertElement(), llvm::IRBuilderBase::CreateShuffleVector(), llvm::FixedVectorType::get(), llvm::PoisonValue::get(), llvm::APInt::getActiveBits(), llvm::CallBase::getCalledFunction(), llvm::InstCombiner::getDataLayout(), llvm::Intrinsic::getDeclaration(), llvm::IntrinsicInst::getIntrinsicID(), llvm::Intrinsic::getIntrinsicSignature(), llvm::Instruction::getModule(), llvm::User::getOperand(), llvm::Value::getType(), llvm::DataLayout::getTypeSizeInBits(), llvm::ConstantInt::getZExtValue(), llvm::APInt::isMask(), llvm::Offset, llvm::APInt::popcount(), llvm::popcount(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::CallBase::setArgOperand(), llvm::IRBuilderBase::SetInsertPoint(), and llvm::Value::takeName().

Referenced by llvm::GCNTTIImpl::instCombineIntrinsic(), and llvm::GCNTTIImpl::simplifyDemandedVectorEltsIntrinsic().

◆ trimTrailingZerosInVector()

static APInt trimTrailingZerosInVector ( InstCombiner IC,
Value UseV,
Instruction I 
)
static