Thanks to visit codestin.com
Credit goes to llvm.org

LLVM 22.0.0git
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()

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, llvm::dyn_cast(), 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()

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::cast(), llvm::ConstantFoldCompareInstOperands(), DL, llvm::ConstantExpr::getBitCast(), llvm::VectorType::getInteger(), llvm::Constant::getNullValue(), and llvm::CmpInst::ICMP_SGT.

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

◆ simplifyTernarylogic()

◆ simplifyX86addcarry()

◆ simplifyX86extrq()

◆ simplifyX86immShift()

◆ simplifyX86insertps()

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

◆ simplifyX86insertq()

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

◆ simplifyX86MaskedLoad()

◆ simplifyX86MaskedStore()

◆ simplifyX86movmsk()

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

◆ simplifyX86pack()

◆ simplifyX86pmadd()

◆ simplifyX86pmulh()

◆ simplifyX86pshufb()

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

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

Definition at line 1976 of file X86InstCombineIntrinsic.cpp.

References llvm::ArrayRef(), assert(), llvm::cast(), llvm::dyn_cast(), llvm::Constant::getAggregateElement(), llvm::Constant::getNullValue(), I, II, and llvm::isa().

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

◆ simplifyX86varShift()

◆ simplifyX86vpermilvar()

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

◆ simplifyX86VPERMMask()

◆ simplifyX86vpermv()

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

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

Definition at line 2068 of file X86InstCombineIntrinsic.cpp.

References llvm::ArrayRef(), assert(), llvm::cast(), llvm::dyn_cast(), llvm::Constant::getAggregateElement(), I, II, llvm::isa(), and Size.

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

◆ simplifyX86vpermv3()

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

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

Definition at line 2102 of file X86InstCombineIntrinsic.cpp.

References llvm::ArrayRef(), assert(), llvm::cast(), llvm::dyn_cast(), llvm::Constant::getAggregateElement(), I, II, llvm::isa(), and Size.

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