LLVM 24.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 Constant * getNegativeIsTrueBoolVec (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 Value * getBoolVecFromMask (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 Instruction * simplifyX86MaskedLoad (IntrinsicInst &II, InstCombiner &IC)
static bool simplifyX86MaskedStore (IntrinsicInst &II, InstCombiner &IC)
static Value * simplifyX86immShift (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder)
static Value * simplifyX86varShift (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder)
static Value * simplifyX86pack (IntrinsicInst &II, InstCombiner::BuilderTy &Builder, bool IsSigned)
static Value * simplifyX86pmulh (IntrinsicInst &II, InstCombiner::BuilderTy &Builder, bool IsSigned, bool IsRounding)
static Value * simplifyX86pmadd (IntrinsicInst &II, InstCombiner::BuilderTy &Builder, bool IsPMADDWD)
static Value * simplifyX86movmsk (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder)
static Value * simplifyX86addcarry (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder)
static Value * simplifyTernarylogic (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder)
static Value * simplifyX86FPMaxMin (const IntrinsicInst &II, InstCombiner &IC, Intrinsic::ID NewIID, bool IsScalar=false)
static Value * simplifyX86insertps (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder)
static Value * simplifyX86extrq (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 Value * simplifyX86insertq (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 Value * simplifyX86pshufb (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder)
 Attempt to convert pshufb* to shufflevector if the mask is constant.
static Value * simplifyX86vpermilvar (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder)
 Attempt to convert vpermilvar* to shufflevector if the mask is constant.
static Value * simplifyX86vpermv (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder)
 Attempt to convert vpermd/vpermps to shufflevector if the mask is constant.
static Value * simplifyX86vpermv3 (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 llvm::cast(), DL, getNegativeIsTrueBoolVec(), llvm::Value::getType(), llvm::isa(), 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()

◆ simplifyX86FPMaxMin()

◆ simplifyX86immShift()

◆ simplifyX86insertps()

◆ simplifyX86insertq()

◆ simplifyX86MaskedLoad()

◆ simplifyX86MaskedStore()

◆ simplifyX86movmsk()

◆ 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 2024 of file X86InstCombineIntrinsic.cpp.

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

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 2116 of file X86InstCombineIntrinsic.cpp.

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

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 2150 of file X86InstCombineIntrinsic.cpp.

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

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