LLVM: llvm::sandboxir::ShuffleVectorInst Class Reference (original) (raw)

#include "[llvm/SandboxIR/Instruction.h](SandboxIR%5F2Instruction%5F8h%5Fsource.html)"

Public Member Functions
LLVM_ABI void commute ()
Swap the operands and adjust the mask to preserve the semantics of the instruction.
LLVM_ABI VectorType * getType () 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.
LLVM_ABI Constant * getShuffleMaskForBitcode () const
Return the mask for this instruction, for use in bitcode.
LLVM_ABI 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
LLVM_ABI BBIterator getIterator () const
\Returns a BasicBlock::iterator for this Instruction.
LLVM_ABI Instruction * getNextNode () const
\Returns the next sandboxir::Instruction in the block, or nullptr if at the end of the block.
LLVM_ABI Instruction * getPrevNode () 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 char * getOpcodeName () const
const DataLayout & getDataLayout () 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.
LLVM_ABI void removeFromParent ()
Detach this from its parent BasicBlock without deleting it.
LLVM_ABI void eraseFromParent ()
Detach this Value from its parent and delete it.
LLVM_ABI void insertBefore (Instruction *BeforeI)
Insert this detached instruction before BeforeI.
LLVM_ABI void insertAfter (Instruction *AfterI)
Insert this detached instruction after AfterI.
LLVM_ABI void insertInto (BasicBlock *BB, const BBIterator &WhereIt)
Insert this detached instruction into BB at WhereIt.
LLVM_ABI 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.
LLVM_ABI BasicBlock * getParent () 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.
LLVM_ABI 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.
LLVM_ABI 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.
LLVM_ABI 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.
LLVM_ABI 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.
LLVM_ABI 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.
LLVM_ABI 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.
LLVM_ABI 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.
LLVM_ABI 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.
LLVM_ABI 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.
LLVM_ABI 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.
LLVM_ABI 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.
LLVM_ABI void setFastMathFlags (FastMathFlags FMF)
Convenience function for setting multiple fast-math flags on this instruction, which must be an operator which supports these flags.
LLVM_ABI 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
LLVM_ABI Type * getAccessType () const
bool mayThrow (bool IncludePhaseOneUnwind=false) const
bool isFenceLike () const
bool mayHaveSideEffects () const
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
Value * getOperand (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
LLVM_ABI use_iterator use_begin ()
const_use_iterator use_begin () const
use_iterator use_end ()
const_use_iterator use_end () const
iterator_range< use_iterator > uses ()
iterator_range< const_use_iterator > uses () const
LLVM_ABI user_iterator user_begin ()
user_iterator user_end ()
const_user_iterator user_begin () const
const_user_iterator user_end () const
iterator_range< user_iterator > users ()
iterator_range< const_user_iterator > users () const
LLVM_ABI 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.
LLVM_ABI Type * getType () const
Context & getContext () const
LLVM_ABI void replaceUsesWithIf (Value *OtherV, llvm::function_ref< bool(const Use &)> ShouldReplace)
LLVM_ABI void replaceAllUsesWith (Value *Other)
StringRef getName () const
\Returns the LLVM IR name of the bottom-most LLVM value.
std::string getUid () const
Returns the unique id in the form 'SB.' like 'SB1.'.
void dumpCommonFooter (raw_ostream &OS) const
void dumpCommonPrefix (raw_ostream &OS) const
void dumpCommonSuffix (raw_ostream &OS) const
void printAsOperandCommon (raw_ostream &OS) const
LLVM_DUMP_METHOD void dump () const
Static Public Member Functions
static LLVM_ABI Value * create (Value *V1, Value *V2, Value *Mask, InsertPosition Pos, Context &Ctx, const Twine &Name="")
static LLVM_ABI Value * create (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 LLVM_ABI Constant * convertShuffleMaskForBitcode (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 LLVM_ABI const char * getOpcodeName (Opcode Opc)
static LLVM_ABI 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.
Additional Inherited Members
Public Types inherited from llvm::sandboxir::Instruction
enum class Opcode
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
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_ABI llvm::Instruction * getTopmostLLVMInstruction () const
A SandboxIR Instruction may map to multiple LLVM IR Instruction.
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.
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.
void swapOperandsInternal (unsigned OpIdxA, unsigned OpIdxB)
void verifyUserOfLLVMUse (const llvm::Use &Use) const
Protected Member Functions inherited from llvm::sandboxir::Value
void clearValue ()
LLVM_ABI Value (ClassID SubclassID, llvm::Value *Val, Context &Ctx)
Value (const Value &)=delete
Disable copies.
Value & operator= (const Value &)=delete
Static Protected Member Functions inherited from llvm::sandboxir::Instruction
static IRBuilder & setInsertPos (InsertPosition Pos)
Helper function for create().
Static Protected Member Functions inherited from llvm::sandboxir::Value
static const char * getSubclassIDStr (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::Value * Val = nullptr
The LLVM Value that corresponds to this SandboxIR Value.
Context & Ctx
All values point to the context.

Definition at line 523 of file Instruction.h.

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 597 of file Instruction.h.

References llvm::cast(), and llvm::sandboxir::Value::Val.

classof()

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

commute()

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

commuteShuffleMask()

convertShuffleMaskForBitcode()

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

create() [1/2]

create() [2/2]

getMaskValue()

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

getShuffleMask() [1/3]

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

getShuffleMask() [2/3]

getShuffleMask() [3/3]

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

getShuffleMaskForBitcode()

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

getType()

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

increasesLength()

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

isBitRotateMask()

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 953 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 664 of file Instruction.h.

References llvm::cast(), and llvm::sandboxir::Value::Val.

isDeInterleaveMaskOfFactor() [1/2]

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

isDeInterleaveMaskOfFactor() [2/2]

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

isExtractSubvectorMask() [1/3]

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

isExtractSubvectorMask() [2/3]

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

isExtractSubvectorMask() [3/3]

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

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 645 of file Instruction.h.

References llvm::cast(), and llvm::sandboxir::Value::Val.

isIdentityMask() [1/2]

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 633 of file Instruction.h.

References llvm::ShuffleVectorInst::isIdentityMask().

isIdentityMask() [2/2]

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

isIdentityWithExtract()

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

isIdentityWithPadding()

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

isInsertSubvectorMask() [1/3]

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 830 of file Instruction.h.

References llvm::ShuffleVectorInst::isInsertSubvectorMask().

isInsertSubvectorMask() [2/3]

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

isInsertSubvectorMask() [3/3]

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

isInterleave()

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

isInterleaveMask() [1/2]

isInterleaveMask() [2/2]

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 918 of file Instruction.h.

References llvm::ShuffleVectorInst::isInterleaveMask().

isOneUseSingleSourceMask() [1/2]

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 877 of file Instruction.h.

References llvm::ShuffleVectorInst::isOneUseSingleSourceMask().

isOneUseSingleSourceMask() [2/2]

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

isReplicationMask() [1/3]

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 851 of file Instruction.h.

References llvm::ShuffleVectorInst::isReplicationMask().

isReplicationMask() [2/3]

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

isReplicationMask() [3/3]

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

isReverse()

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

isReverseMask() [1/2]

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 700 of file Instruction.h.

References llvm::ShuffleVectorInst::isReverseMask().

isReverseMask() [2/2]

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

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 691 of file Instruction.h.

References llvm::cast(), and llvm::sandboxir::Value::Val.

isSelectMask() [1/2]

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 676 of file Instruction.h.

References llvm::ShuffleVectorInst::isSelectMask().

isSelectMask() [2/2]

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

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 624 of file Instruction.h.

References llvm::cast(), and llvm::sandboxir::Value::Val.

isSingleSourceMask() [1/2]

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

isSingleSourceMask() [2/2]

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

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 803 of file Instruction.h.

References llvm::cast(), and llvm::sandboxir::Value::Val.

isSpliceMask() [1/2]

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 791 of file Instruction.h.

References llvm::ShuffleVectorInst::isSpliceMask().

isSpliceMask() [2/2]

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

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 781 of file Instruction.h.

References llvm::cast(), and llvm::sandboxir::Value::Val.

isTransposeMask() [1/2]

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 768 of file Instruction.h.

References llvm::ShuffleVectorInst::isTransposeMask().

isTransposeMask() [2/2]

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

isValidOperands() [1/2]

isValidOperands() [2/2]

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 732 of file Instruction.h.

References llvm::cast(), and llvm::sandboxir::Value::Val.

isZeroEltSplatMask() [1/2]

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 720 of file Instruction.h.

References llvm::ShuffleVectorInst::isZeroEltSplatMask().

isZeroEltSplatMask() [2/2]

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

setShuffleMask()

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

Context


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