LLVM 20.0.0git
|
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 * | 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) |
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.
#define DEBUG_TYPE "x86tti" |
Definition at line 26 of file X86InstCombineIntrinsic.cpp.
|
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().
|
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().
|
static |
Definition at line 675 of file X86InstCombineIntrinsic.cpp.
References A, llvm::And, assert(), B, llvm::CallingConv::C, llvm::IRBuilderBase::CreateAnd(), llvm::IRBuilderBase::CreateNot(), llvm::IRBuilderBase::CreateOr(), llvm::IRBuilderBase::CreateXor(), llvm::Constant::getAllOnesValue(), llvm::Constant::getNullValue(), II, llvm::PatternMatch::m_ImmConstant(), llvm::PatternMatch::match(), llvm::Or, and llvm::Xor.
Referenced by llvm::X86TTIImpl::instCombineIntrinsic().
|
static |
Definition at line 648 of file X86InstCombineIntrinsic.cpp.
References assert(), llvm::IRBuilderBase::CreateExtractValue(), llvm::IRBuilderBase::CreateInsertValue(), llvm::IRBuilderBase::CreateIntrinsic(), llvm::IRBuilderBase::CreateZExt(), llvm::PoisonValue::get(), llvm::IRBuilderBase::getInt8Ty(), llvm::Value::getType(), II, llvm::PatternMatch::m_ZeroInt(), llvm::PatternMatch::match(), and RetTy.
Referenced by llvm::X86TTIImpl::instCombineIntrinsic().
|
static |
Attempt to simplify SSE4A EXTRQ/EXTRQI instructions using constant folding or conversion to a shuffle vector.
Definition at line 1802 of file X86InstCombineIntrinsic.cpp.
References llvm::IRBuilderBase::CreateBitCast(), llvm::IRBuilderBase::CreateIntrinsic(), llvm::IRBuilderBase::CreateShuffleVector(), End, llvm::ConstantVector::get(), llvm::FixedVectorType::get(), llvm::UndefValue::get(), llvm::ConstantAggregateZero::get(), llvm::Type::getInt64Ty(), llvm::Type::getInt8Ty(), llvm::ConstantInt::getValue(), llvm::APInt::getZExtValue(), II, llvm::Length, llvm::APInt::lshrInPlace(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::APInt::zextOrTrunc().
Referenced by llvm::X86TTIImpl::instCombineIntrinsic().
|
static |
Definition at line 121 of file X86InstCombineIntrinsic.cpp.
References assert(), llvm::BitWidth, llvm::computeKnownBits(), llvm::IRBuilderBase::CreateAShr(), llvm::IRBuilderBase::CreateLShr(), llvm::IRBuilderBase::CreateShl(), llvm::IRBuilderBase::CreateShuffleVector(), llvm::IRBuilderBase::CreateVectorSplat(), llvm::IRBuilderBase::CreateZExtOrTrunc(), llvm::ConstantAggregateZero::get(), llvm::APInt::getBitsSet(), llvm::KnownBits::getMaxValue(), llvm::KnownBits::getMinValue(), llvm::APInt::getOneBitSet(), llvm::Type::getPrimitiveSizeInBits(), llvm::Value::getType(), II, llvm::Type::isIntegerTy(), llvm::Type::isVectorTy(), llvm::APInt::isZero(), llvm::KnownBits::isZero(), llvm_unreachable, llvm::APInt::uge(), llvm::APInt::ult(), and llvm::APInt::zextOrTrunc().
Referenced by llvm::X86TTIImpl::instCombineIntrinsic().
|
static |
Definition at line 1743 of file X86InstCombineIntrinsic.cpp.
References assert(), llvm::IRBuilderBase::CreateShuffleVector(), llvm::ConstantAggregateZero::get(), and II.
Referenced by llvm::X86TTIImpl::instCombineIntrinsic().
|
static |
Attempt to simplify SSE4A INSERTQ/INSERTQI instructions using constant folding or conversion to a shuffle vector.
Definition at line 1891 of file X86InstCombineIntrinsic.cpp.
References llvm::IRBuilderBase::CreateBitCast(), llvm::IRBuilderBase::CreateIntrinsic(), llvm::IRBuilderBase::CreateShuffleVector(), End, llvm::ConstantVector::get(), llvm::FixedVectorType::get(), llvm::UndefValue::get(), llvm::Type::getInt64Ty(), llvm::Type::getInt8Ty(), llvm::APInt::getLowBitsSet(), llvm::APInt::getZExtValue(), II, llvm::Length, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::APInt::shl(), and llvm::APInt::zextOrTrunc().
Referenced by llvm::X86TTIImpl::instCombineIntrinsic().
|
static |
Definition at line 58 of file X86InstCombineIntrinsic.cpp.
References llvm::InstCombiner::Builder, llvm::IRBuilderBase::CreateBitCast(), llvm::IRBuilderBase::CreateMaskedLoad(), getBoolVecFromMask(), llvm::InstCombiner::getDataLayout(), llvm::Constant::getNullValue(), II, Ptr, and llvm::InstCombiner::replaceInstUsesWith().
Referenced by llvm::X86TTIImpl::instCombineIntrinsic().
|
static |
Definition at line 88 of file X86InstCombineIntrinsic.cpp.
References llvm::InstCombiner::Builder, llvm::IRBuilderBase::CreateBitCast(), llvm::IRBuilderBase::CreateMaskedStore(), llvm::InstCombiner::eraseInstFromFunction(), getBoolVecFromMask(), llvm::InstCombiner::getDataLayout(), llvm::Value::getType(), II, and Ptr.
Referenced by llvm::X86TTIImpl::instCombineIntrinsic().
|
static |
Definition at line 617 of file X86InstCombineIntrinsic.cpp.
References llvm::IRBuilderBase::CreateBitCast(), llvm::IRBuilderBase::CreateIsNeg(), llvm::IRBuilderBase::CreateZExtOrTrunc(), llvm::IRBuilderBase::getIntNTy(), llvm::Constant::getNullValue(), llvm::Value::getType(), and II.
Referenced by llvm::X86TTIImpl::instCombineIntrinsic().
|
static |
Definition at line 439 of file X86InstCombineIntrinsic.cpp.
References assert(), llvm::IRBuilderBase::CreateICmpSGT(), llvm::IRBuilderBase::CreateICmpSLT(), llvm::IRBuilderBase::CreateSelect(), llvm::IRBuilderBase::CreateShuffleVector(), llvm::IRBuilderBase::CreateTrunc(), llvm::UndefValue::get(), llvm::Constant::getIntegerValue(), llvm::APInt::getLowBitsSet(), getNumElements(), llvm::Type::getPrimitiveSizeInBits(), llvm::Type::getScalarSizeInBits(), llvm::APInt::getSignedMaxValue(), llvm::APInt::getSignedMinValue(), llvm::Value::getType(), llvm::APInt::getZero(), II, llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::APInt::sext().
Referenced by llvm::X86TTIImpl::instCombineIntrinsic().
|
static |
Definition at line 563 of file X86InstCombineIntrinsic.cpp.
References assert(), llvm::IRBuilderBase::CreateAdd(), llvm::IRBuilderBase::CreateCast(), llvm::IRBuilderBase::CreateIntrinsic(), llvm::IRBuilderBase::CreateMul(), llvm::IRBuilderBase::CreateShuffleVector(), llvm::ConstantAggregateZero::get(), llvm::Value::getType(), Hi, I, II, Lo, and llvm::SmallVectorTemplateBase< T, bool >::push_back().
Referenced by llvm::X86TTIImpl::instCombineIntrinsic().
|
static |
Definition at line 505 of file X86InstCombineIntrinsic.cpp.
References assert(), llvm::IRBuilderBase::CreateAdd(), llvm::IRBuilderBase::CreateAShr(), llvm::IRBuilderBase::CreateCast(), llvm::IRBuilderBase::CreateLShr(), llvm::IRBuilderBase::CreateMul(), llvm::IRBuilderBase::CreateTrunc(), llvm::IntegerType::get(), llvm::FixedVectorType::get(), llvm::ConstantAggregateZero::get(), llvm::FixedVectorType::getExtendedElementVectorType(), llvm::Value::getType(), II, LHS, llvm::PatternMatch::m_One(), llvm::PatternMatch::match(), Mul, and RHS.
Referenced by llvm::X86TTIImpl::instCombineIntrinsic().
|
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().
|
static |
Definition at line 303 of file X86InstCombineIntrinsic.cpp.
References llvm::all_of(), assert(), llvm::BitWidth, llvm::computeKnownBits(), llvm::IRBuilderBase::CreateAShr(), llvm::IRBuilderBase::CreateLShr(), llvm::IRBuilderBase::CreateShl(), llvm::ConstantVector::get(), llvm::UndefValue::get(), llvm::Type::getIntegerBitWidth(), llvm::KnownBits::getMaxValue(), llvm::APInt::getZExtValue(), I, Idx, II, llvm_unreachable, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::APInt::uge(), and llvm::APInt::ult().
Referenced by llvm::X86TTIImpl::instCombineIntrinsic().
|
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().
|
static |
Definition at line 2144 of file X86InstCombineIntrinsic.cpp.
References assert(), llvm::APInt::getLowBitsSet(), II, llvm::isPowerOf2_32(), llvm::Log2_32(), and llvm::InstCombiner::SimplifyDemandedBits().
Referenced by llvm::X86TTIImpl::instCombineIntrinsic().
|
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().
|
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().