LLVM 22.0.0git
AMDGPUInstCombineIntrinsic.cpp File Reference
#include "AMDGPUInstrInfo.h"
#include "AMDGPUTargetTransformInfo.h"
#include "GCNSubtarget.h"
#include "llvm/ADT/FloatingPointMode.h"
#include "llvm/IR/Dominators.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 ValuematchFPExtFromF16 (Value *Arg)
 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)
static bool isTriviallyUniform (const Use &U)
 Return true if we can easily prove that use U is uniform.
static CallInstrewriteCall (IRBuilderBase &B, CallInst &Old, Function &NewCallee, ArrayRef< Value * > Ops)

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "AMDGPUtti"

Definition at line 29 of file AMDGPUInstCombineIntrinsic.cpp.

◆ GET_AMDGPUImageDMaskIntrinsicTable_IMPL

#define GET_AMDGPUImageDMaskIntrinsicTable_IMPL

Definition at line 37 of file AMDGPUInstCombineIntrinsic.cpp.

Function Documentation

◆ canContractSqrtToRsq()

bool canContractSqrtToRsq ( const FPMathOperator * SqrtOp)
static

◆ canSafelyConvertTo16Bit()

◆ convertTo16Bit()

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

◆ defaultComponentBroadcast()

◆ fmed3AMDGCN()

◆ isTriviallyUniform()

bool isTriviallyUniform ( const Use & U)
static

◆ matchFPExtFromF16()

◆ modifyIntrinsicCall()

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

◆ rewriteCall()

◆ simplifyAMDGCNImageIntrinsic()

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

Definition at line 154 of file AMDGPUInstCombineIntrinsic.cpp.

References assert(), llvm::AMDGPU::ImageDimIntrinsicInfo::BaseOpcode, llvm::AMDGPU::ImageDimIntrinsicInfo::BiasIndex, canSafelyConvertTo16Bit(), llvm::cast(), llvm::AMDGPU::ImageDimIntrinsicInfo::CoordStart, llvm::AMDGPU::ImageDimIntrinsicInfo::Dim, llvm::dyn_cast(), llvm::SmallVectorImpl< T >::emplace_back(), llvm::SmallVectorTemplateCommon< T, typename >::empty(), llvm::InstCombiner::eraseInstFromFunction(), for(), llvm::Type::getHalfTy(), llvm::AMDGPU::getImageDimIntrinsicByBaseOpcode(), llvm::Type::getInt16Ty(), llvm::Intrinsic::getIntrinsicSignature(), llvm::AMDGPU::getMIMGBaseOpcodeInfo(), llvm::AMDGPU::getMIMGBiasMappingInfo(), llvm::AMDGPU::getMIMGLZMappingInfo(), llvm::AMDGPU::getMIMGMIPMappingInfo(), llvm::AMDGPU::getMIMGOffsetMappingInfo(), llvm::Intrinsic::getOrInsertDeclaration(), llvm::Type::getScalarType(), llvm::Value::getType(), llvm::Type::getWithNewType(), llvm::AMDGPU::ImageDimIntrinsicInfo::GradientStart, llvm::AMDGPU::MIMGBaseOpcodeInfo::HasD16, if(), II, llvm::AMDGPU::ImageDimIntrinsicInfo::Intr, llvm::Type::isFloatingPointTy(), llvm::Type::isHalfTy(), llvm::AMDGPU::ImageDimIntrinsicInfo::LodIndex, llvm::AMDGPU::ImageDimIntrinsicInfo::MipIndex, modifyIntrinsicCall(), llvm::AMDGPU::ImageDimIntrinsicInfo::NumBiasArgs, llvm::AMDGPU::ImageDimIntrinsicInfo::OffsetIndex, llvm::AMDGPU::MIMGBaseOpcodeInfo::Sampler, llvm::Value::takeName(), and llvm::AMDGPU::ImageDimIntrinsicInfo::VAddrEnd.

Referenced by llvm::GCNTTIImpl::instCombineIntrinsic().

◆ simplifyAMDGCNMemoryIntrinsicDemanded()

◆ trimTrailingZerosInVector()