LLVM 20.0.0git
Macros | Functions
X86InstCombineIntrinsic.cpp File Reference

This file implements a TargetTransformInfo analysis pass specific to the X86 target machine. More...

#include "X86TargetTransformInfo.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/IntrinsicsX86.h"
#include "llvm/Support/KnownBits.h"
#include "llvm/Transforms/InstCombine/InstCombiner.h"
#include <optional>

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "x86tti"
 

Functions

static ConstantgetNegativeIsTrueBoolVec (Constant *V, const DataLayout &DL)
 Return a constant boolean vector that has true elements in all positions where the input constant data vector has an element with the sign bit set.
 
static ValuegetBoolVecFromMask (Value *Mask, const DataLayout &DL)
 Convert the x86 XMM integer vector mask to a vector of bools based on each element's most significant bit (the sign bit).
 
static InstructionsimplifyX86MaskedLoad (IntrinsicInst &II, InstCombiner &IC)
 
static bool simplifyX86MaskedStore (IntrinsicInst &II, InstCombiner &IC)
 
static ValuesimplifyX86immShift (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder)
 
static ValuesimplifyX86varShift (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder)
 
static ValuesimplifyX86pack (IntrinsicInst &II, InstCombiner::BuilderTy &Builder, bool IsSigned)
 
static ValuesimplifyX86pmulh (IntrinsicInst &II, InstCombiner::BuilderTy &Builder, bool IsSigned, bool IsRounding)
 
static ValuesimplifyX86pmadd (IntrinsicInst &II, InstCombiner::BuilderTy &Builder, bool IsPMADDWD)
 
static ValuesimplifyX86movmsk (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder)
 
static ValuesimplifyX86addcarry (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder)
 
static ValuesimplifyTernarylogic (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder)
 
static ValuesimplifyX86insertps (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder)
 
static ValuesimplifyX86extrq (IntrinsicInst &II, Value *Op0, ConstantInt *CILength, ConstantInt *CIIndex, InstCombiner::BuilderTy &Builder)
 Attempt to simplify SSE4A EXTRQ/EXTRQI instructions using constant folding or conversion to a shuffle vector.
 
static ValuesimplifyX86insertq (IntrinsicInst &II, Value *Op0, Value *Op1, APInt APLength, APInt APIndex, InstCombiner::BuilderTy &Builder)
 Attempt to simplify SSE4A INSERTQ/INSERTQI instructions using constant folding or conversion to a shuffle vector.
 
static ValuesimplifyX86pshufb (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder)
 Attempt to convert pshufb* to shufflevector if the mask is constant.
 
static ValuesimplifyX86vpermilvar (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder)
 Attempt to convert vpermilvar* to shufflevector if the mask is constant.
 
static ValuesimplifyX86vpermv (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder)
 Attempt to convert vpermd/vpermps to shufflevector if the mask is constant.
 
static ValuesimplifyX86vpermv3 (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder)
 Attempt to convert vpermi2/vpermt2 to shufflevector if the mask is constant.
 
static bool simplifyX86VPERMMask (Instruction *II, bool IsBinary, InstCombiner &IC)
 

Detailed Description

This file implements a TargetTransformInfo analysis pass specific to the X86 target machine.

It uses the target's detailed information to provide more precise answers to certain TTI queries, while letting the target independent and default TTI implementations handle the rest.

Definition in file X86InstCombineIntrinsic.cpp.

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "x86tti"

Definition at line 26 of file X86InstCombineIntrinsic.cpp.

Function Documentation

◆ getBoolVecFromMask()

static Value * getBoolVecFromMask ( Value Mask,
const DataLayout DL 
)
static

Convert the x86 XMM integer vector mask to a vector of bools based on each element's most significant bit (the sign bit).

Definition at line 41 of file X86InstCombineIntrinsic.cpp.

References DL, getNegativeIsTrueBoolVec(), llvm::Value::getType(), llvm::Type::isIntOrIntVectorTy(), llvm::PatternMatch::m_SExt(), llvm::PatternMatch::m_Value(), and llvm::PatternMatch::match().

Referenced by simplifyX86MaskedLoad(), and simplifyX86MaskedStore().

◆ getNegativeIsTrueBoolVec()

static Constant * getNegativeIsTrueBoolVec ( Constant V,
const DataLayout DL 
)
static

Return a constant boolean vector that has true elements in all positions where the input constant data vector has an element with the sign bit set.

Definition at line 30 of file X86InstCombineIntrinsic.cpp.

References assert(), llvm::ConstantFoldCompareInstOperands(), DL, llvm::ConstantExpr::getBitCast(), llvm::Constant::getNullValue(), and llvm::CmpInst::ICMP_SGT.

Referenced by getBoolVecFromMask(), and llvm::X86TTIImpl::instCombineIntrinsic().

◆ simplifyTernarylogic()

static Value * simplifyTernarylogic ( const IntrinsicInst II,
InstCombiner::BuilderTy Builder 
)
static

◆ simplifyX86addcarry()

static Value * simplifyX86addcarry ( const IntrinsicInst II,
InstCombiner::BuilderTy Builder 
)
static

◆ simplifyX86extrq()

static Value * simplifyX86extrq ( IntrinsicInst II,
Value Op0,
ConstantInt CILength,
ConstantInt CIIndex,
InstCombiner::BuilderTy Builder 
)
static

◆ simplifyX86immShift()

static Value * simplifyX86immShift ( const IntrinsicInst II,
InstCombiner::BuilderTy Builder 
)
static

◆ simplifyX86insertps()

static Value * simplifyX86insertps ( const IntrinsicInst II,
InstCombiner::BuilderTy Builder 
)
static

◆ simplifyX86insertq()

static Value * simplifyX86insertq ( IntrinsicInst II,
Value Op0,
Value Op1,
APInt  APLength,
APInt  APIndex,
InstCombiner::BuilderTy Builder 
)
static

◆ simplifyX86MaskedLoad()

static Instruction * simplifyX86MaskedLoad ( IntrinsicInst II,
InstCombiner IC 
)
static

◆ simplifyX86MaskedStore()

static bool simplifyX86MaskedStore ( IntrinsicInst II,
InstCombiner IC 
)
static

◆ simplifyX86movmsk()

static Value * simplifyX86movmsk ( const IntrinsicInst II,
InstCombiner::BuilderTy Builder 
)
static

◆ simplifyX86pack()

static Value * simplifyX86pack ( IntrinsicInst II,
InstCombiner::BuilderTy Builder,
bool  IsSigned 
)
static

◆ simplifyX86pmadd()

static Value * simplifyX86pmadd ( IntrinsicInst II,
InstCombiner::BuilderTy Builder,
bool  IsPMADDWD 
)
static

◆ simplifyX86pmulh()

static Value * simplifyX86pmulh ( IntrinsicInst II,
InstCombiner::BuilderTy Builder,
bool  IsSigned,
bool  IsRounding 
)
static

◆ simplifyX86pshufb()

static Value * simplifyX86pshufb ( const IntrinsicInst II,
InstCombiner::BuilderTy Builder 
)
static

Attempt to convert pshufb* to shufflevector if the mask is constant.

Definition at line 1982 of file X86InstCombineIntrinsic.cpp.

References assert(), llvm::IRBuilderBase::CreateShuffleVector(), llvm::Constant::getNullValue(), I, and II.

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

◆ simplifyX86varShift()

static Value * simplifyX86varShift ( const IntrinsicInst II,
InstCombiner::BuilderTy Builder 
)
static

◆ simplifyX86vpermilvar()

static Value * simplifyX86vpermilvar ( const IntrinsicInst II,
InstCombiner::BuilderTy Builder 
)
static

Attempt to convert vpermilvar* to shufflevector if the mask is constant.

Definition at line 2027 of file X86InstCombineIntrinsic.cpp.

References assert(), llvm::IRBuilderBase::CreateShuffleVector(), I, and II.

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

◆ simplifyX86VPERMMask()

static bool simplifyX86VPERMMask ( Instruction II,
bool  IsBinary,
InstCombiner IC 
)
static

◆ simplifyX86vpermv()

static Value * simplifyX86vpermv ( const IntrinsicInst II,
InstCombiner::BuilderTy Builder 
)
static

Attempt to convert vpermd/vpermps to shufflevector if the mask is constant.

Definition at line 2074 of file X86InstCombineIntrinsic.cpp.

References assert(), llvm::IRBuilderBase::CreateShuffleVector(), I, II, and Size.

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

◆ simplifyX86vpermv3()

static Value * simplifyX86vpermv3 ( const IntrinsicInst II,
InstCombiner::BuilderTy Builder 
)
static

Attempt to convert vpermi2/vpermt2 to shufflevector if the mask is constant.

Definition at line 2108 of file X86InstCombineIntrinsic.cpp.

References assert(), llvm::IRBuilderBase::CreateShuffleVector(), I, II, and Size.

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