mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-30 17:25:21 +00:00
Added support for the following definition of shufflevector
<result> = shufflevector <n x <ty>> <v1>, <n x <ty>> <v2>, <m x i32> <mask> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58964 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1287,10 +1287,12 @@ ShuffleVectorInst::ShuffleVectorInst(const ShuffleVectorInst &SV)
|
||||
ShuffleVectorInst::ShuffleVectorInst(Value *V1, Value *V2, Value *Mask,
|
||||
const std::string &Name,
|
||||
Instruction *InsertBefore)
|
||||
: Instruction(V1->getType(), ShuffleVector,
|
||||
OperandTraits<ShuffleVectorInst>::op_begin(this),
|
||||
OperandTraits<ShuffleVectorInst>::operands(this),
|
||||
InsertBefore) {
|
||||
: Instruction(VectorType::get(cast<VectorType>(V1->getType())->getElementType(),
|
||||
cast<VectorType>(Mask->getType())->getNumElements()),
|
||||
ShuffleVector,
|
||||
OperandTraits<ShuffleVectorInst>::op_begin(this),
|
||||
OperandTraits<ShuffleVectorInst>::operands(this),
|
||||
InsertBefore) {
|
||||
assert(isValidOperands(V1, V2, Mask) &&
|
||||
"Invalid shuffle vector instruction operands!");
|
||||
Op<0>() = V1;
|
||||
@@ -1300,7 +1302,7 @@ ShuffleVectorInst::ShuffleVectorInst(Value *V1, Value *V2, Value *Mask,
|
||||
}
|
||||
|
||||
ShuffleVectorInst::ShuffleVectorInst(Value *V1, Value *V2, Value *Mask,
|
||||
const std::string &Name,
|
||||
const std::string &Name,
|
||||
BasicBlock *InsertAtEnd)
|
||||
: Instruction(V1->getType(), ShuffleVector,
|
||||
OperandTraits<ShuffleVectorInst>::op_begin(this),
|
||||
@@ -1315,17 +1317,14 @@ ShuffleVectorInst::ShuffleVectorInst(Value *V1, Value *V2, Value *Mask,
|
||||
setName(Name);
|
||||
}
|
||||
|
||||
bool ShuffleVectorInst::isValidOperands(const Value *V1, const Value *V2,
|
||||
bool ShuffleVectorInst::isValidOperands(const Value *V1, const Value *V2,
|
||||
const Value *Mask) {
|
||||
if (!isa<VectorType>(V1->getType()) ||
|
||||
V1->getType() != V2->getType())
|
||||
if (!isa<VectorType>(V1->getType()) || V1->getType() != V2->getType())
|
||||
return false;
|
||||
|
||||
const VectorType *MaskTy = dyn_cast<VectorType>(Mask->getType());
|
||||
if (!isa<Constant>(Mask) || MaskTy == 0 ||
|
||||
MaskTy->getElementType() != Type::Int32Ty ||
|
||||
MaskTy->getNumElements() !=
|
||||
cast<VectorType>(V1->getType())->getNumElements())
|
||||
MaskTy->getElementType() != Type::Int32Ty)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user