LLVM 20.0.0git
Public Member Functions | Static Public Member Functions | Friends | List of all members
llvm::sandboxir::ShuffleVectorInst Class Referencefinal

#include "llvm/SandboxIR/Instruction.h"

Inheritance diagram for llvm::sandboxir::ShuffleVectorInst:
Inheritance graph
[legend]

Public Member Functions

void commute ()
 Swap the operands and adjust the mask to preserve the semantics of the instruction.
 
VectorTypegetType () const
 Overload to return most specific vector type.
 
int getMaskValue (unsigned Elt) const
 Return the shuffle mask value of this instruction for the given element index.
 
void getShuffleMask (SmallVectorImpl< int > &Result) const
 Return the mask for this instruction as a vector of integers.
 
ConstantgetShuffleMaskForBitcode () const
 Return the mask for this instruction, for use in bitcode.
 
void setShuffleMask (ArrayRef< int > Mask)
 
ArrayRef< int > getShuffleMask () const
 
bool changesLength () const
 Return true if this shuffle returns a vector with a different number of elements than its source vectors.
 
bool increasesLength () const
 Return true if this shuffle returns a vector with a greater number of elements than its source vectors.
 
bool isSingleSource () const
 Return true if this shuffle chooses elements from exactly one source vector without changing the length of that vector.
 
bool isIdentity () const
 Return true if this shuffle chooses elements from exactly one source vector without lane crossings and does not change the number of elements from its input vectors.
 
bool isIdentityWithPadding () const
 Return true if this shuffle lengthens exactly one source vector with undefs in the high elements.
 
bool isIdentityWithExtract () const
 Return true if this shuffle extracts the first N elements of exactly one source vector.
 
bool isConcat () const
 Return true if this shuffle concatenates its 2 source vectors.
 
bool isSelect () const
 Return true if this shuffle chooses elements from its source vectors without lane crossings and all operands have the same number of elements.
 
bool isReverse () const
 Return true if this shuffle swaps the order of elements from exactly one source vector.
 
bool isZeroEltSplat () const
 Return true if all elements of this shuffle are the same value as the first element of exactly one source vector without changing the length of that vector.
 
bool isTranspose () const
 Return true if this shuffle transposes the elements of its inputs without changing the length of the vectors.
 
bool isSplice (int &Index) const
 Return true if this shuffle splices two inputs without changing the length of the vectors.
 
bool isExtractSubvectorMask (int &Index) const
 Return true if this shuffle mask is an extract subvector mask.
 
bool isInsertSubvectorMask (int &NumSubElts, int &Index) const
 Return true if this shuffle mask is an insert subvector mask.
 
bool isReplicationMask (int &ReplicationFactor, int &VF) const
 Return true if this shuffle mask is a replication mask.
 
bool isOneUseSingleSourceMask (int VF) const
 Return true if this shuffle mask is a one-use-single-source("clustered") mask.
 
bool isInterleave (unsigned Factor) const
 Return if this shuffle interleaves its two input vectors together.
 
- Public Member Functions inherited from llvm::sandboxir::SingleLLVMInstructionImpl< llvm::ShuffleVectorInst >
unsigned getUseOperandNo (const Use &Use) const final
 \Returns the operand index of Use.
 
unsigned getNumOfIRInstrs () const final
 This is used by BasicBlock::iterator.
 
void verify () const final
 Should crash if there is something wrong with the instruction.
 
void dumpOS (raw_ostream &OS) const override
 
- Public Member Functions inherited from llvm::sandboxir::Instruction
virtual unsigned getNumOfIRInstrs () const =0
 This is used by BasicBlock::iterator.
 
BBIterator getIterator () const
 \Returns a BasicBlock::iterator for this Instruction.
 
InstructiongetNextNode () const
 \Returns the next sandboxir::Instruction in the block, or nullptr if at the end of the block.
 
InstructiongetPrevNode () const
 \Returns the previous sandboxir::Instruction in the block, or nullptr if at the beginning of the block.
 
Opcode getOpcode () const
 \Returns this Instruction's opcode.
 
const chargetOpcodeName () const
 
const DataLayoutgetDataLayout () const
 
bool isTerminator () const
 
bool isUnaryOp () const
 
bool isBinaryOp () const
 
bool isIntDivRem () const
 
bool isShift () const
 
bool isCast () const
 
bool isFuncletPad () const
 
bool isSpecialTerminator () const
 
bool isOnlyUserOfAnyOperand () const
 
bool isLogicalShift () const
 
bool hasMetadata () const
 Return true if the instruction has any metadata attached to it.
 
bool hasMetadataOtherThanDebugLoc () const
 Return true if this instruction has metadata attached to it other than a debug location.
 
bool hasMetadata (unsigned KindID) const
 Return true if this instruction has the given type of metadata attached.
 
void removeFromParent ()
 Detach this from its parent BasicBlock without deleting it.
 
void eraseFromParent ()
 Detach this Value from its parent and delete it.
 
void insertBefore (Instruction *BeforeI)
 Insert this detached instruction before BeforeI.
 
void insertAfter (Instruction *AfterI)
 Insert this detached instruction after AfterI.
 
void insertInto (BasicBlock *BB, const BBIterator &WhereIt)
 Insert this detached instruction into BB at WhereIt.
 
void moveBefore (BasicBlock &BB, const BBIterator &WhereIt)
 Move this instruction to WhereIt.
 
void moveBefore (Instruction *Before)
 Move this instruction before Before.
 
void moveAfter (Instruction *After)
 Move this instruction after After.
 
bool comesBefore (const Instruction *Other) const
 Given an instruction Other in the same basic block as this instruction, return true if this instruction comes before Other.
 
BasicBlockgetParent () const
 \Returns the BasicBlock containing this Instruction, or null if it is detached.
 
bool hasNoUnsignedWrap () const
 Determine whether the no signed wrap flag is set.
 
void setHasNoUnsignedWrap (bool B=true)
 Set or clear the nuw flag on this instruction, which must be an operator which supports this flag.
 
bool hasNoSignedWrap () const
 Determine whether the no signed wrap flag is set.
 
void setHasNoSignedWrap (bool B=true)
 Set or clear the nsw flag on this instruction, which must be an operator which supports this flag.
 
bool isFast () const
 Determine whether all fast-math-flags are set.
 
void setFast (bool B)
 Set or clear all fast-math-flags on this instruction, which must be an operator which supports this flag.
 
bool hasAllowReassoc () const
 Determine whether the allow-reassociation flag is set.
 
void setHasAllowReassoc (bool B)
 Set or clear the reassociation flag on this instruction, which must be an operator which supports this flag.
 
bool isExact () const
 Determine whether the exact flag is set.
 
void setIsExact (bool B=true)
 Set or clear the exact flag on this instruction, which must be an operator which supports this flag.
 
bool hasNoNaNs () const
 Determine whether the no-NaNs flag is set.
 
void setHasNoNaNs (bool B)
 Set or clear the no-nans flag on this instruction, which must be an operator which supports this flag.
 
bool hasNoInfs () const
 Determine whether the no-infs flag is set.
 
void setHasNoInfs (bool B)
 Set or clear the no-infs flag on this instruction, which must be an operator which supports this flag.
 
bool hasNoSignedZeros () const
 Determine whether the no-signed-zeros flag is set.
 
void setHasNoSignedZeros (bool B)
 Set or clear the no-signed-zeros flag on this instruction, which must be an operator which supports this flag.
 
bool hasAllowReciprocal () const
 Determine whether the allow-reciprocal flag is set.
 
void setHasAllowReciprocal (bool B)
 Set or clear the allow-reciprocal flag on this instruction, which must be an operator which supports this flag.
 
bool hasAllowContract () const
 Determine whether the allow-contract flag is set.
 
void setHasAllowContract (bool B)
 Set or clear the allow-contract flag on this instruction, which must be an operator which supports this flag.
 
bool hasApproxFunc () const
 Determine whether the approximate-math-functions flag is set.
 
void setHasApproxFunc (bool B)
 Set or clear the approximate-math-functions flag on this instruction, which must be an operator which supports this flag.
 
FastMathFlags getFastMathFlags () const
 Convenience function for getting all the fast-math flags, which must be an operator which supports these flags.
 
void setFastMathFlags (FastMathFlags FMF)
 Convenience function for setting multiple fast-math flags on this instruction, which must be an operator which supports these flags.
 
void copyFastMathFlags (FastMathFlags FMF)
 Convenience function for transferring all fast-math flag values to this instruction, which must be an operator which supports these flags.
 
bool isAssociative () const
 
bool isCommutative () const
 
bool isIdempotent () const
 
bool isNilpotent () const
 
bool mayWriteToMemory () const
 
bool mayReadFromMemory () const
 
bool mayReadOrWriteMemory () const
 
bool isAtomic () const
 
bool hasAtomicLoad () const
 
bool hasAtomicStore () const
 
bool isVolatile () const
 
TypegetAccessType () const
 
bool mayThrow (bool IncludePhaseOneUnwind=false) const
 
bool isFenceLike () const
 
bool mayHaveSideEffects () const
 
void dumpOS (raw_ostream &OS) const override
 
- Public Member Functions inherited from llvm::sandboxir::User
virtual op_iterator op_begin ()
 
virtual op_iterator op_end ()
 
virtual const_op_iterator op_begin () const
 
virtual const_op_iterator op_end () const
 
op_range operands ()
 
const_op_range operands () const
 
ValuegetOperand (unsigned OpIdx) const
 
Use getOperandUse (unsigned OpIdx) const
 \Returns the operand edge for OpIdx.
 
virtual unsigned getNumOperands () const
 
virtual void setOperand (unsigned OperandIdx, Value *Operand)
 
bool replaceUsesOfWith (Value *FromV, Value *ToV)
 Replaces any operands that match FromV with ToV.
 
void verify () const override
 Should crash if there is something wrong with the instruction.
 
void dumpCommonHeader (raw_ostream &OS) const final
 
void dumpOS (raw_ostream &OS) const override
 
- Public Member Functions inherited from llvm::sandboxir::Value
virtual ~Value ()=default
 
ClassID getSubclassID () const
 
use_iterator use_begin ()
 
const_use_iterator use_begin () const
 
use_iterator use_end ()
 
const_use_iterator use_end () const
 
iterator_range< use_iteratoruses ()
 
iterator_range< const_use_iteratoruses () const
 
user_iterator user_begin ()
 
user_iterator user_end ()
 
const_user_iterator user_begin () const
 
const_user_iterator user_end () const
 
iterator_range< user_iteratorusers ()
 
iterator_range< const_user_iteratorusers () const
 
unsigned getNumUses () const
 \Returns the number of user edges (not necessarily to unique users).
 
bool hasNUsesOrMore (unsigned Num) const
 Return true if this value has N uses or more.
 
bool hasNUses (unsigned Num) const
 Return true if this Value has exactly N uses.
 
TypegetType () const
 
ContextgetContext () const
 
void replaceUsesWithIf (Value *OtherV, llvm::function_ref< bool(const Use &)> ShouldReplace)
 
void replaceAllUsesWith (Value *Other)
 
StringRef getName () const
 \Returns the LLVM IR name of the bottom-most LLVM value.
 
virtual void verify () const =0
 Should crash if there is something wrong with the instruction.
 
std::string getUid () const
 Returns the unique id in the form 'SB<number>.' like 'SB1.'.
 
virtual void dumpCommonHeader (raw_ostream &OS) const
 
void dumpCommonFooter (raw_ostream &OS) const
 
void dumpCommonPrefix (raw_ostream &OS) const
 
void dumpCommonSuffix (raw_ostream &OS) const
 
void printAsOperandCommon (raw_ostream &OS) const
 
virtual void dumpOS (raw_ostream &OS) const =0
 
LLVM_DUMP_METHOD void dump () const
 

Static Public Member Functions

static Valuecreate (Value *V1, Value *V2, Value *Mask, InsertPosition Pos, Context &Ctx, const Twine &Name="")
 
static Valuecreate (Value *V1, Value *V2, ArrayRef< int > Mask, InsertPosition Pos, Context &Ctx, const Twine &Name="")
 
static bool classof (const Value *From)
 
static bool isValidOperands (const Value *V1, const Value *V2, const Value *Mask)
 Return true if a shufflevector instruction can be formed with the specified operands.
 
static bool isValidOperands (const Value *V1, const Value *V2, ArrayRef< int > Mask)
 
static void getShuffleMask (const Constant *Mask, SmallVectorImpl< int > &Result)
 Convert the input shuffle mask operand to a vector of integers.
 
static ConstantconvertShuffleMaskForBitcode (ArrayRef< int > Mask, Type *ResultTy)
 
static bool isSingleSourceMask (ArrayRef< int > Mask, int NumSrcElts)
 Return true if this shuffle mask chooses elements from exactly one source vector.
 
static bool isSingleSourceMask (const Constant *Mask, int NumSrcElts)
 
static bool isIdentityMask (ArrayRef< int > Mask, int NumSrcElts)
 Return true if this shuffle mask chooses elements from exactly one source vector without lane crossings.
 
static bool isIdentityMask (const Constant *Mask, int NumSrcElts)
 
static bool isSelectMask (ArrayRef< int > Mask, int NumSrcElts)
 Return true if this shuffle mask chooses elements from its source vectors without lane crossings.
 
static bool isSelectMask (const Constant *Mask, int NumSrcElts)
 
static bool isReverseMask (ArrayRef< int > Mask, int NumSrcElts)
 Return true if this shuffle mask swaps the order of elements from exactly one source vector.
 
static bool isReverseMask (const Constant *Mask, int NumSrcElts)
 
static bool isZeroEltSplatMask (ArrayRef< int > Mask, int NumSrcElts)
 Return true if this shuffle mask chooses all elements with the same value as the first element of exactly one source vector.
 
static bool isZeroEltSplatMask (const Constant *Mask, int NumSrcElts)
 
static bool isTransposeMask (ArrayRef< int > Mask, int NumSrcElts)
 Return true if this shuffle mask is a transpose mask.
 
static bool isTransposeMask (const Constant *Mask, int NumSrcElts)
 
static bool isSpliceMask (ArrayRef< int > Mask, int NumSrcElts, int &Index)
 Return true if this shuffle mask is a splice mask, concatenating the two inputs together and then extracts an original width vector starting from the splice index.
 
static bool isSpliceMask (const Constant *Mask, int NumSrcElts, int &Index)
 
static bool isExtractSubvectorMask (ArrayRef< int > Mask, int NumSrcElts, int &Index)
 Return true if this shuffle mask is an extract subvector mask.
 
static bool isExtractSubvectorMask (const Constant *Mask, int NumSrcElts, int &Index)
 
static bool isInsertSubvectorMask (ArrayRef< int > Mask, int NumSrcElts, int &NumSubElts, int &Index)
 Return true if this shuffle mask is an insert subvector mask.
 
static bool isInsertSubvectorMask (const Constant *Mask, int NumSrcElts, int &NumSubElts, int &Index)
 
static bool isReplicationMask (ArrayRef< int > Mask, int &ReplicationFactor, int &VF)
 Return true if this shuffle mask replicates each of the VF elements in a vector ReplicationFactor times.
 
static bool isReplicationMask (const Constant *Mask, int &ReplicationFactor, int &VF)
 
static bool isOneUseSingleSourceMask (ArrayRef< int > Mask, int VF)
 Return true if this shuffle mask represents "clustered" mask of size VF, i.e.
 
static void commuteShuffleMask (MutableArrayRef< int > Mask, unsigned InVecNumElts)
 Change values in a shuffle permute mask assuming the two vector operands of length InVecNumElts have swapped position.
 
static bool isInterleaveMask (ArrayRef< int > Mask, unsigned Factor, unsigned NumInputElts, SmallVectorImpl< unsigned > &StartIndexes)
 Return true if the mask interleaves one or more input vectors together.
 
static bool isInterleaveMask (ArrayRef< int > Mask, unsigned Factor, unsigned NumInputElts)
 
static bool isDeInterleaveMaskOfFactor (ArrayRef< int > Mask, unsigned Factor, unsigned &Index)
 Check if the mask is a DE-interleave mask of the given factor Factor like: <Index, Index+Factor, ..., Index+(NumElts-1)*Factor>
 
static bool isDeInterleaveMaskOfFactor (ArrayRef< int > Mask, unsigned Factor)
 
static bool isBitRotateMask (ArrayRef< int > Mask, unsigned EltSizeInBits, unsigned MinSubElts, unsigned MaxSubElts, unsigned &NumSubElts, unsigned &RotateAmt)
 Checks if the shuffle is a bit rotation of the first operand across multiple subelements, e.g:
 
- Static Public Member Functions inherited from llvm::sandboxir::Instruction
static const chargetOpcodeName (Opcode Opc)
 
static bool classof (const sandboxir::Value *From)
 For isa/dyn_cast.
 
- Static Public Member Functions inherited from llvm::sandboxir::User
static bool classof (const Value *From)
 For isa/dyn_cast.
 

Friends

class Context
 

Additional Inherited Members

- Public Types inherited from llvm::sandboxir::Instruction
enum class  Opcode { OP , OPCODES , DEF_INSTR }
 
- Public Types inherited from llvm::sandboxir::User
using op_iterator = OperandUseIterator
 
using const_op_iterator = OperandUseIterator
 
using op_range = iterator_range< op_iterator >
 
using const_op_range = iterator_range< const_op_iterator >
 
- Public Types inherited from llvm::sandboxir::Value
enum class  ClassID : unsigned { DEF_VALUE , DEF_USER , DEF_CONST , DEF_INSTR }
 
using use_iterator = UserUseIterator
 
using const_use_iterator = UserUseIterator
 
using user_iterator = mapped_iterator< sandboxir::UserUseIterator, UseToUser >
 
using const_user_iterator = user_iterator
 
- Protected Member Functions inherited from llvm::sandboxir::Instruction
 Instruction (ClassID ID, Opcode Opc, llvm::Instruction *I, sandboxir::Context &SBCtx)
 
llvm::InstructiongetTopmostLLVMInstruction () const
 A SandboxIR Instruction may map to multiple LLVM IR Instruction.
 
virtual SmallVector< llvm::Instruction *, 1 > getLLVMInstrs () const =0
 \Returns the LLVM IR Instructions that this SandboxIR maps to in program order.
 
- Protected Member Functions inherited from llvm::sandboxir::User
 User (ClassID ID, llvm::Value *V, Context &Ctx)
 
Use getOperandUseDefault (unsigned OpIdx, bool Verify) const
 \Returns the Use edge that corresponds to OpIdx.
 
virtual Use getOperandUseInternal (unsigned OpIdx, bool Verify) const =0
 \Returns the Use for the OpIdx'th operand.
 
unsigned getUseOperandNoDefault (const Use &Use) const
 The default implementation works only for single-LLVMIR-instruction Users and only if they match exactly the LLVM instruction.
 
virtual unsigned getUseOperandNo (const Use &Use) const =0
 \Returns the operand index of Use.
 
void swapOperandsInternal (unsigned OpIdxA, unsigned OpIdxB)
 
void verifyUserOfLLVMUse (const llvm::Use &Use) const
 
- Protected Member Functions inherited from llvm::sandboxir::Value
void clearValue ()
 
 Value (ClassID SubclassID, llvm::Value *Val, Context &Ctx)
 
 Value (const Value &)=delete
 Disable copies.
 
Valueoperator= (const Value &)=delete
 
- Static Protected Member Functions inherited from llvm::sandboxir::Instruction
static IRBuildersetInsertPos (InsertPosition Pos)
 Helper function for create().
 
- Static Protected Member Functions inherited from llvm::sandboxir::Value
static const chargetSubclassIDStr (ClassID ID)
 
- Protected Attributes inherited from llvm::sandboxir::Instruction
Opcode Opc
 
- Protected Attributes inherited from llvm::sandboxir::Value
ClassID SubclassID
 For isa/dyn_cast.
 
unsigned UID
 A unique ID used for forming the name (used for debugging).
 
llvm::ValueVal = nullptr
 The LLVM Value that corresponds to this SandboxIR Value.
 
ContextCtx
 All values point to the context.
 

Detailed Description

Definition at line 522 of file Instruction.h.

Member Function Documentation

◆ changesLength()

bool llvm::sandboxir::ShuffleVectorInst::changesLength ( ) const
inline

Return true if this shuffle returns a vector with a different number of elements than its source vectors.

Examples: shufflevector <4 x n> A, <4 x n> B, <1,2,3> shufflevector <4 x n> A, <4 x n> B, <1,2,3,4,5>

Definition at line 595 of file Instruction.h.

References llvm::sandboxir::Value::Val.

◆ classof()

static bool llvm::sandboxir::ShuffleVectorInst::classof ( const Value From)
inlinestatic

Definition at line 536 of file Instruction.h.

References From.

◆ commute()

void llvm::sandboxir::ShuffleVectorInst::commute ( )

Swap the operands and adjust the mask to preserve the semantics of the instruction.

Definition at line 1499 of file Instruction.cpp.

References llvm::sandboxir::Value::Ctx, llvm::sandboxir::Tracker::emplaceIfTracking(), llvm::sandboxir::User::getOperandUse(), llvm::sandboxir::Context::getTracker(), and llvm::sandboxir::Value::Val.

◆ commuteShuffleMask()

static void llvm::sandboxir::ShuffleVectorInst::commuteShuffleMask ( MutableArrayRef< int >  Mask,
unsigned  InVecNumElts 
)
inlinestatic

Change values in a shuffle permute mask assuming the two vector operands of length InVecNumElts have swapped position.

Definition at line 887 of file Instruction.h.

References llvm::ShuffleVectorInst::commuteShuffleMask().

◆ convertShuffleMaskForBitcode()

Constant * llvm::sandboxir::ShuffleVectorInst::convertShuffleMaskForBitcode ( ArrayRef< int >  Mask,
Type ResultTy 
)
static

◆ create() [1/2]

Value * llvm::sandboxir::ShuffleVectorInst::create ( Value V1,
Value V2,
ArrayRef< int >  Mask,
InsertPosition  Pos,
Context Ctx,
const Twine Name = "" 
)
static

◆ create() [2/2]

Value * llvm::sandboxir::ShuffleVectorInst::create ( Value V1,
Value V2,
Value Mask,
InsertPosition  Pos,
Context Ctx,
const Twine Name = "" 
)
static

◆ getMaskValue()

int llvm::sandboxir::ShuffleVectorInst::getMaskValue ( unsigned  Elt) const
inline

Return the shuffle mask value of this instruction for the given element index.

Return PoisonMaskElem if the element is undef.

Definition at line 561 of file Instruction.h.

References llvm::sandboxir::Value::Val.

◆ getShuffleMask() [1/3]

ArrayRef< int > llvm::sandboxir::ShuffleVectorInst::getShuffleMask ( ) const
inline

Definition at line 587 of file Instruction.h.

References llvm::sandboxir::Value::Val.

◆ getShuffleMask() [2/3]

static void llvm::sandboxir::ShuffleVectorInst::getShuffleMask ( const Constant Mask,
SmallVectorImpl< int > &  Result 
)
inlinestatic

Convert the input shuffle mask operand to a vector of integers.

Undefined elements of the mask are returned as PoisonMaskElem.

Definition at line 567 of file Instruction.h.

References llvm::ShuffleVectorInst::getShuffleMask().

◆ getShuffleMask() [3/3]

void llvm::sandboxir::ShuffleVectorInst::getShuffleMask ( SmallVectorImpl< int > &  Result) const
inline

Return the mask for this instruction as a vector of integers.

Undefined elements of the mask are returned as PoisonMaskElem.

Definition at line 575 of file Instruction.h.

References llvm::sandboxir::Value::Val.

◆ getShuffleMaskForBitcode()

Constant * llvm::sandboxir::ShuffleVectorInst::getShuffleMaskForBitcode ( ) const

Return the mask for this instruction, for use in bitcode.

Definition at line 1506 of file Instruction.cpp.

References llvm::sandboxir::Value::Ctx, llvm::sandboxir::Context::getOrCreateConstant(), getShuffleMaskForBitcode(), and llvm::sandboxir::Value::Val.

Referenced by getShuffleMaskForBitcode().

◆ getType()

VectorType * llvm::sandboxir::ShuffleVectorInst::getType ( ) const

Overload to return most specific vector type.

Definition at line 1494 of file Instruction.cpp.

References llvm::sandboxir::Value::Ctx, llvm::sandboxir::Context::getType(), and llvm::sandboxir::Value::Val.

◆ increasesLength()

bool llvm::sandboxir::ShuffleVectorInst::increasesLength ( ) const
inline

Return true if this shuffle returns a vector with a greater number of elements than its source vectors.

Example: shufflevector <2 x n> A, <2 x n> B, <1,2,3>

Definition at line 602 of file Instruction.h.

References llvm::sandboxir::Value::Val.

◆ isBitRotateMask()

static bool llvm::sandboxir::ShuffleVectorInst::isBitRotateMask ( ArrayRef< int >  Mask,
unsigned  EltSizeInBits,
unsigned  MinSubElts,
unsigned  MaxSubElts,
unsigned NumSubElts,
unsigned RotateAmt 
)
inlinestatic

Checks if the shuffle is a bit rotation of the first operand across multiple subelements, e.g:

shuffle <8 x i8> a, <8 x i8> poison, <8 x i32> <1, 0, 3, 2, 5, 4, 7, 6>

could be expressed as

rotl <4 x i16> a, 8

If it can be expressed as a rotation, returns the number of subelements to group by in NumSubElts and the number of bits to rotate left in RotateAmt.

Definition at line 951 of file Instruction.h.

References llvm::ShuffleVectorInst::isBitRotateMask().

◆ isConcat()

bool llvm::sandboxir::ShuffleVectorInst::isConcat ( ) const
inline

Return true if this shuffle concatenates its 2 source vectors.

This returns false if either input is undefined. In that case, the shuffle is is better classified as an identity with padding operation.

Definition at line 662 of file Instruction.h.

References llvm::sandboxir::Value::Val.

◆ isDeInterleaveMaskOfFactor() [1/2]

static bool llvm::sandboxir::ShuffleVectorInst::isDeInterleaveMaskOfFactor ( ArrayRef< int >  Mask,
unsigned  Factor 
)
inlinestatic

◆ isDeInterleaveMaskOfFactor() [2/2]

static bool llvm::sandboxir::ShuffleVectorInst::isDeInterleaveMaskOfFactor ( ArrayRef< int >  Mask,
unsigned  Factor,
unsigned Index 
)
inlinestatic

Check if the mask is a DE-interleave mask of the given factor Factor like: <Index, Index+Factor, ..., Index+(NumElts-1)*Factor>

Definition at line 931 of file Instruction.h.

References Index, and llvm::ShuffleVectorInst::isDeInterleaveMaskOfFactor().

◆ isExtractSubvectorMask() [1/3]

static bool llvm::sandboxir::ShuffleVectorInst::isExtractSubvectorMask ( ArrayRef< int >  Mask,
int  NumSrcElts,
int &  Index 
)
inlinestatic

Return true if this shuffle mask is an extract subvector mask.

A valid extract subvector mask returns a smaller vector from a single source operand. The base extraction index is returned as well.

Definition at line 808 of file Instruction.h.

References Index, and llvm::ShuffleVectorInst::isExtractSubvectorMask().

◆ isExtractSubvectorMask() [2/3]

static bool llvm::sandboxir::ShuffleVectorInst::isExtractSubvectorMask ( const Constant Mask,
int  NumSrcElts,
int &  Index 
)
inlinestatic

Definition at line 813 of file Instruction.h.

References Index, and llvm::ShuffleVectorInst::isExtractSubvectorMask().

◆ isExtractSubvectorMask() [3/3]

bool llvm::sandboxir::ShuffleVectorInst::isExtractSubvectorMask ( int &  Index) const
inline

Return true if this shuffle mask is an extract subvector mask.

Definition at line 820 of file Instruction.h.

References Index, and llvm::sandboxir::Value::Val.

◆ isIdentity()

bool llvm::sandboxir::ShuffleVectorInst::isIdentity ( ) const
inline

Return true if this shuffle chooses elements from exactly one source vector without lane crossings and does not change the number of elements from its input vectors.

Example: shufflevector <4 x n> A, <4 x n> B, <4,undef,6,undef>

Definition at line 643 of file Instruction.h.

References llvm::sandboxir::Value::Val.

◆ isIdentityMask() [1/2]

static bool llvm::sandboxir::ShuffleVectorInst::isIdentityMask ( ArrayRef< int >  Mask,
int  NumSrcElts 
)
inlinestatic

Return true if this shuffle mask chooses elements from exactly one source vector without lane crossings.

A shuffle using this mask is not necessarily a no-op because it may change the number of elements from its input vectors or it may provide demanded bits knowledge via undef lanes. Example: <undef,undef,2,3>

Definition at line 631 of file Instruction.h.

References llvm::ShuffleVectorInst::isIdentityMask().

◆ isIdentityMask() [2/2]

static bool llvm::sandboxir::ShuffleVectorInst::isIdentityMask ( const Constant Mask,
int  NumSrcElts 
)
inlinestatic

Definition at line 634 of file Instruction.h.

References llvm::ShuffleVectorInst::isIdentityMask().

◆ isIdentityWithExtract()

bool llvm::sandboxir::ShuffleVectorInst::isIdentityWithExtract ( ) const
inline

Return true if this shuffle extracts the first N elements of exactly one source vector.

Definition at line 655 of file Instruction.h.

References llvm::sandboxir::Value::Val.

◆ isIdentityWithPadding()

bool llvm::sandboxir::ShuffleVectorInst::isIdentityWithPadding ( ) const
inline

Return true if this shuffle lengthens exactly one source vector with undefs in the high elements.

Definition at line 649 of file Instruction.h.

References llvm::sandboxir::Value::Val.

◆ isInsertSubvectorMask() [1/3]

static bool llvm::sandboxir::ShuffleVectorInst::isInsertSubvectorMask ( ArrayRef< int >  Mask,
int  NumSrcElts,
int &  NumSubElts,
int &  Index 
)
inlinestatic

Return true if this shuffle mask is an insert subvector mask.

A valid insert subvector mask inserts the lowest elements of a second source operand into an in-place first source operand. Both the sub vector width and the insertion index is returned.

Definition at line 828 of file Instruction.h.

References Index, and llvm::ShuffleVectorInst::isInsertSubvectorMask().

◆ isInsertSubvectorMask() [2/3]

static bool llvm::sandboxir::ShuffleVectorInst::isInsertSubvectorMask ( const Constant Mask,
int  NumSrcElts,
int &  NumSubElts,
int &  Index 
)
inlinestatic

Definition at line 833 of file Instruction.h.

References Index, and llvm::ShuffleVectorInst::isInsertSubvectorMask().

◆ isInsertSubvectorMask() [3/3]

bool llvm::sandboxir::ShuffleVectorInst::isInsertSubvectorMask ( int &  NumSubElts,
int &  Index 
) const
inline

Return true if this shuffle mask is an insert subvector mask.

Definition at line 840 of file Instruction.h.

References Index, and llvm::sandboxir::Value::Val.

◆ isInterleave()

bool llvm::sandboxir::ShuffleVectorInst::isInterleave ( unsigned  Factor) const
inline

Return if this shuffle interleaves its two input vectors together.

Definition at line 893 of file Instruction.h.

References llvm::sandboxir::Value::Val.

◆ isInterleaveMask() [1/2]

static bool llvm::sandboxir::ShuffleVectorInst::isInterleaveMask ( ArrayRef< int >  Mask,
unsigned  Factor,
unsigned  NumInputElts 
)
inlinestatic

Definition at line 922 of file Instruction.h.

References llvm::ShuffleVectorInst::isInterleaveMask().

◆ isInterleaveMask() [2/2]

static bool llvm::sandboxir::ShuffleVectorInst::isInterleaveMask ( ArrayRef< int >  Mask,
unsigned  Factor,
unsigned  NumInputElts,
SmallVectorImpl< unsigned > &  StartIndexes 
)
inlinestatic

Return true if the mask interleaves one or more input vectors together.

I.e. <0, LaneLen, ... , LaneLen*(Factor - 1), 1, LaneLen + 1, ...> E.g. For a Factor of 2 (LaneLen=4): <0, 4, 1, 5, 2, 6, 3, 7> E.g. For a Factor of 3 (LaneLen=4): <4, 0, 9, 5, 1, 10, 6, 2, 11, 7, 3, 12> E.g. For a Factor of 4 (LaneLen=2): <0, 2, 6, 4, 1, 3, 7, 5>

NumInputElts is the total number of elements in the input vectors.

StartIndexes are the first indexes of each vector being interleaved, substituting any indexes that were undef E.g. <4, -1, 2, 5, 1, 3> (Factor=3): StartIndexes=<4, 0, 2>

Note that this does not check if the input vectors are consecutive: It will return true for masks such as <0, 4, 6, 1, 5, 7> (Factor=3, LaneLen=2)

Definition at line 916 of file Instruction.h.

References llvm::ShuffleVectorInst::isInterleaveMask().

◆ isOneUseSingleSourceMask() [1/2]

static bool llvm::sandboxir::ShuffleVectorInst::isOneUseSingleSourceMask ( ArrayRef< int >  Mask,
int  VF 
)
inlinestatic

Return true if this shuffle mask represents "clustered" mask of size VF, i.e.

each index between [0..VF) is used exactly once in each submask of size VF. For example, the mask for VF=4 is: 0, 1, 2, 3, 3, 2, 0, 1 - "clustered", because each submask of size 4 (0,1,2,3 and 3,2,0,1) uses indices [0..VF) exactly one time. 0, 1, 2, 3, 3, 3, 1, 0 - not "clustered", because element 3 is used twice in the second submask (3,3,1,0) and index 2 is not used at all.

Definition at line 875 of file Instruction.h.

References llvm::ShuffleVectorInst::isOneUseSingleSourceMask().

◆ isOneUseSingleSourceMask() [2/2]

bool llvm::sandboxir::ShuffleVectorInst::isOneUseSingleSourceMask ( int  VF) const
inline

Return true if this shuffle mask is a one-use-single-source("clustered") mask.

Definition at line 881 of file Instruction.h.

References llvm::sandboxir::Value::Val.

◆ isReplicationMask() [1/3]

static bool llvm::sandboxir::ShuffleVectorInst::isReplicationMask ( ArrayRef< int >  Mask,
int &  ReplicationFactor,
int &  VF 
)
inlinestatic

Return true if this shuffle mask replicates each of the VF elements in a vector ReplicationFactor times.

For example, the mask for ReplicationFactor=3 and VF=4 is: <0,0,0,1,1,1,2,2,2,3,3,3>

Definition at line 849 of file Instruction.h.

References llvm::ShuffleVectorInst::isReplicationMask().

◆ isReplicationMask() [2/3]

static bool llvm::sandboxir::ShuffleVectorInst::isReplicationMask ( const Constant Mask,
int &  ReplicationFactor,
int &  VF 
)
inlinestatic

Definition at line 854 of file Instruction.h.

References llvm::ShuffleVectorInst::isReplicationMask().

◆ isReplicationMask() [3/3]

bool llvm::sandboxir::ShuffleVectorInst::isReplicationMask ( int &  ReplicationFactor,
int &  VF 
) const
inline

Return true if this shuffle mask is a replication mask.

Definition at line 861 of file Instruction.h.

References llvm::sandboxir::Value::Val.

◆ isReverse()

bool llvm::sandboxir::ShuffleVectorInst::isReverse ( ) const
inline

Return true if this shuffle swaps the order of elements from exactly one source vector.

Example: shufflevector <4 x n> A, <4 x n> B, <3,undef,1,undef>

Definition at line 709 of file Instruction.h.

References llvm::sandboxir::Value::Val.

◆ isReverseMask() [1/2]

static bool llvm::sandboxir::ShuffleVectorInst::isReverseMask ( ArrayRef< int >  Mask,
int  NumSrcElts 
)
inlinestatic

Return true if this shuffle mask swaps the order of elements from exactly one source vector.

Example: <7,6,undef,4> This assumes that vector operands (of length NumSrcElts) are the same length as the mask.

Definition at line 698 of file Instruction.h.

References llvm::ShuffleVectorInst::isReverseMask().

◆ isReverseMask() [2/2]

static bool llvm::sandboxir::ShuffleVectorInst::isReverseMask ( const Constant Mask,
int  NumSrcElts 
)
inlinestatic

Definition at line 701 of file Instruction.h.

References llvm::ShuffleVectorInst::isReverseMask().

◆ isSelect()

bool llvm::sandboxir::ShuffleVectorInst::isSelect ( ) const
inline

Return true if this shuffle chooses elements from its source vectors without lane crossings and all operands have the same number of elements.

In other words, this shuffle is equivalent to a vector select with a constant condition operand. Example: shufflevector <4 x n> A, <4 x n> B, <undef,1,6,3> This returns false if the mask does not choose from both input vectors. In that case, the shuffle is better classified as an identity shuffle.

Definition at line 689 of file Instruction.h.

References llvm::sandboxir::Value::Val.

◆ isSelectMask() [1/2]

static bool llvm::sandboxir::ShuffleVectorInst::isSelectMask ( ArrayRef< int >  Mask,
int  NumSrcElts 
)
inlinestatic

Return true if this shuffle mask chooses elements from its source vectors without lane crossings.

A shuffle using this mask would be equivalent to a vector select with a constant condition operand. Example: <4,1,6,undef> This returns false if the mask does not choose from both input vectors. In that case, the shuffle is better classified as an identity shuffle. This assumes that vector operands are the same length as the mask (a length-changing shuffle can never be equivalent to a vector select).

Definition at line 674 of file Instruction.h.

References llvm::ShuffleVectorInst::isSelectMask().

◆ isSelectMask() [2/2]

static bool llvm::sandboxir::ShuffleVectorInst::isSelectMask ( const Constant Mask,
int  NumSrcElts 
)
inlinestatic

Definition at line 677 of file Instruction.h.

References llvm::ShuffleVectorInst::isSelectMask().

◆ isSingleSource()

bool llvm::sandboxir::ShuffleVectorInst::isSingleSource ( ) const
inline

Return true if this shuffle chooses elements from exactly one source vector without changing the length of that vector.

Example: shufflevector <4 x n> A, <4 x n> B, <3,0,undef,3>

Definition at line 622 of file Instruction.h.

References llvm::sandboxir::Value::Val.

◆ isSingleSourceMask() [1/2]

static bool llvm::sandboxir::ShuffleVectorInst::isSingleSourceMask ( ArrayRef< int >  Mask,
int  NumSrcElts 
)
inlinestatic

Return true if this shuffle mask chooses elements from exactly one source vector.

Example: <7,5,undef,7> This assumes that vector operands (of length NumSrcElts) are the same length as the mask.

Definition at line 611 of file Instruction.h.

References llvm::ShuffleVectorInst::isSingleSourceMask().

◆ isSingleSourceMask() [2/2]

static bool llvm::sandboxir::ShuffleVectorInst::isSingleSourceMask ( const Constant Mask,
int  NumSrcElts 
)
inlinestatic

Definition at line 614 of file Instruction.h.

References llvm::ShuffleVectorInst::isSingleSourceMask().

◆ isSplice()

bool llvm::sandboxir::ShuffleVectorInst::isSplice ( int &  Index) const
inline

Return true if this shuffle splices two inputs without changing the length of the vectors.

This operation concatenates the two inputs together and then extracts an original width vector starting from the splice index. Example: shufflevector <4 x n> A, <4 x n> B, <1,2,3,4>

Definition at line 801 of file Instruction.h.

References Index, and llvm::sandboxir::Value::Val.

◆ isSpliceMask() [1/2]

static bool llvm::sandboxir::ShuffleVectorInst::isSpliceMask ( ArrayRef< int >  Mask,
int  NumSrcElts,
int &  Index 
)
inlinestatic

Return true if this shuffle mask is a splice mask, concatenating the two inputs together and then extracts an original width vector starting from the splice index.

Example: shufflevector <4 x n> A, <4 x n> B, <1,2,3,4> This assumes that vector operands (of length NumSrcElts) are the same length as the mask.

Definition at line 789 of file Instruction.h.

References Index, and llvm::ShuffleVectorInst::isSpliceMask().

◆ isSpliceMask() [2/2]

static bool llvm::sandboxir::ShuffleVectorInst::isSpliceMask ( const Constant Mask,
int  NumSrcElts,
int &  Index 
)
inlinestatic

Definition at line 792 of file Instruction.h.

References Index, and llvm::ShuffleVectorInst::isSpliceMask().

◆ isTranspose()

bool llvm::sandboxir::ShuffleVectorInst::isTranspose ( ) const
inline

Return true if this shuffle transposes the elements of its inputs without changing the length of the vectors.

This operation may also be known as a merge or interleave. See the description for isTransposeMask() for the exact specification. Example: shufflevector <4 x n> A, <4 x n> B, <0,4,2,6>

Definition at line 779 of file Instruction.h.

References llvm::sandboxir::Value::Val.

◆ isTransposeMask() [1/2]

static bool llvm::sandboxir::ShuffleVectorInst::isTransposeMask ( ArrayRef< int >  Mask,
int  NumSrcElts 
)
inlinestatic

Return true if this shuffle mask is a transpose mask.

Transpose vector masks transpose a 2xn matrix. They read corresponding even- or odd-numbered vector elements from two n-dimensional source vectors and write each result into consecutive elements of an n-dimensional destination vector. Two shuffles are necessary to complete the transpose, one for the even elements and another for the odd elements. This description closely follows how the TRN1 and TRN2 AArch64 instructions operate.

For example, a simple 2x2 matrix can be transposed with:

; Original matrix m0 = < a, b > m1 = < c, d >

; Transposed matrix t0 = < a, c > = shufflevector m0, m1, < 0, 2 > t1 = < b, d > = shufflevector m0, m1, < 1, 3 >

For matrices having greater than n columns, the resulting nx2 transposed matrix is stored in two result vectors such that one vector contains interleaved elements from all the even-numbered rows and the other vector contains interleaved elements from all the odd-numbered rows. For example, a 2x4 matrix can be transposed with:

; Original matrix m0 = < a, b, c, d > m1 = < e, f, g, h >

; Transposed matrix t0 = < a, e, c, g > = shufflevector m0, m1 < 0, 4, 2, 6 > t1 = < b, f, d, h > = shufflevector m0, m1 < 1, 5, 3, 7 >

Definition at line 766 of file Instruction.h.

References llvm::ShuffleVectorInst::isTransposeMask().

◆ isTransposeMask() [2/2]

static bool llvm::sandboxir::ShuffleVectorInst::isTransposeMask ( const Constant Mask,
int  NumSrcElts 
)
inlinestatic

Definition at line 769 of file Instruction.h.

References llvm::ShuffleVectorInst::isTransposeMask().

◆ isValidOperands() [1/2]

static bool llvm::sandboxir::ShuffleVectorInst::isValidOperands ( const Value V1,
const Value V2,
ArrayRef< int >  Mask 
)
inlinestatic

◆ isValidOperands() [2/2]

static bool llvm::sandboxir::ShuffleVectorInst::isValidOperands ( const Value V1,
const Value V2,
const Value Mask 
)
inlinestatic

Return true if a shufflevector instruction can be formed with the specified operands.

Definition at line 546 of file Instruction.h.

References llvm::ShuffleVectorInst::isValidOperands(), and llvm::sandboxir::Value::Val.

◆ isZeroEltSplat()

bool llvm::sandboxir::ShuffleVectorInst::isZeroEltSplat ( ) const
inline

Return true if all elements of this shuffle are the same value as the first element of exactly one source vector without changing the length of that vector.

Example: shufflevector <4 x n> A, <4 x n> B, <undef,0,undef,0>

Definition at line 730 of file Instruction.h.

References llvm::sandboxir::Value::Val.

◆ isZeroEltSplatMask() [1/2]

static bool llvm::sandboxir::ShuffleVectorInst::isZeroEltSplatMask ( ArrayRef< int >  Mask,
int  NumSrcElts 
)
inlinestatic

Return true if this shuffle mask chooses all elements with the same value as the first element of exactly one source vector.

Example: <4,undef,undef,4> This assumes that vector operands (of length NumSrcElts) are the same length as the mask.

Definition at line 718 of file Instruction.h.

References llvm::ShuffleVectorInst::isZeroEltSplatMask().

◆ isZeroEltSplatMask() [2/2]

static bool llvm::sandboxir::ShuffleVectorInst::isZeroEltSplatMask ( const Constant Mask,
int  NumSrcElts 
)
inlinestatic

Definition at line 721 of file Instruction.h.

References llvm::ShuffleVectorInst::isZeroEltSplatMask().

◆ setShuffleMask()

void llvm::sandboxir::ShuffleVectorInst::setShuffleMask ( ArrayRef< int >  Mask)

Friends And Related Function Documentation

◆ Context

friend class Context
friend

Definition at line 528 of file Instruction.h.


The documentation for this class was generated from the following files: