#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>
usingnamespacellvm;
usingnamespacellvm::PatternMatch;
#define DEBUG_TYPE …
static Constant *getNegativeIsTrueBoolVec(Constant *V, const DataLayout &DL) { … }
static Value *getBoolVecFromMask(Value *Mask, const DataLayout &DL) { … }
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) { … }
static Value *simplifyX86insertq(IntrinsicInst &II, Value *Op0, Value *Op1,
APInt APLength, APInt APIndex,
InstCombiner::BuilderTy &Builder) { … }
static Value *simplifyX86pshufb(const IntrinsicInst &II,
InstCombiner::BuilderTy &Builder) { … }
static Value *simplifyX86vpermilvar(const IntrinsicInst &II,
InstCombiner::BuilderTy &Builder) { … }
static Value *simplifyX86vpermv(const IntrinsicInst &II,
InstCombiner::BuilderTy &Builder) { … }
static Value *simplifyX86vpermv3(const IntrinsicInst &II,
InstCombiner::BuilderTy &Builder) { … }
static bool simplifyX86VPERMMask(Instruction *II, bool IsBinary,
InstCombiner &IC) { … }
std::optional<Instruction *>
X86TTIImpl::instCombineIntrinsic(InstCombiner &IC, IntrinsicInst &II) const { … }
std::optional<Value *> X86TTIImpl::simplifyDemandedUseBitsIntrinsic(
InstCombiner &IC, IntrinsicInst &II, APInt DemandedMask, KnownBits &Known,
bool &KnownBitsComputed) const { … }
std::optional<Value *> X86TTIImpl::simplifyDemandedVectorEltsIntrinsic(
InstCombiner &IC, IntrinsicInst &II, APInt DemandedElts, APInt &UndefElts,
APInt &UndefElts2, APInt &UndefElts3,
std::function<void(Instruction *, unsigned, APInt, APInt &)>
simplifyAndSetOp) const { … }