Skip to content

Commit dc75d0f

Browse files
[RISCV][GISEL] Add IRTranslation for insertelement with scalable vector type
1 parent 2fcfc97 commit dc75d0f

File tree

4 files changed

+1948
-6
lines changed

4 files changed

+1948
-6
lines changed

llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2963,7 +2963,8 @@ bool IRTranslator::translateInsertElement(const User &U,
29632963
MachineIRBuilder &MIRBuilder) {
29642964
// If it is a <1 x Ty> vector, use the scalar as it is
29652965
// not a legal vector type in LLT.
2966-
if (cast<FixedVectorType>(U.getType())->getNumElements() == 1)
2966+
if (auto *FVT = dyn_cast<FixedVectorType>(U.getType());
2967+
FVT && FVT->getNumElements() == 1)
29672968
return translateCopy(U, *U.getOperand(1), MIRBuilder);
29682969

29692970
Register Res = getOrCreateVReg(U);

llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,8 +1282,8 @@ MachineIRBuilder::buildInstr(unsigned Opc, ArrayRef<DstOp> DstOps,
12821282
SrcOps[1].getLLTTy(*getMRI()) &&
12831283
"Type mismatch");
12841284
assert(SrcOps[2].getLLTTy(*getMRI()).isScalar() && "Invalid index");
1285-
assert(DstOps[0].getLLTTy(*getMRI()).getNumElements() ==
1286-
SrcOps[0].getLLTTy(*getMRI()).getNumElements() &&
1285+
assert(DstOps[0].getLLTTy(*getMRI()).getElementCount() ==
1286+
SrcOps[0].getLLTTy(*getMRI()).getElementCount() &&
12871287
"Type mismatch");
12881288
break;
12891289
}

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20629,11 +20629,11 @@ unsigned RISCVTargetLowering::getCustomCtpopCost(EVT VT,
2062920629

2063020630
bool RISCVTargetLowering::fallBackToDAGISel(const Instruction &Inst) const {
2063120631

20632-
// GISel support is in progress or complete for G_ADD, G_SUB, G_AND, G_OR, and
20633-
// G_XOR.
20632+
// GISel support is in progress or complete for these opcodes.
2063420633
unsigned Op = Inst.getOpcode();
2063520634
if (Op == Instruction::Add || Op == Instruction::Sub ||
20636-
Op == Instruction::And || Op == Instruction::Or || Op == Instruction::Xor)
20635+
Op == Instruction::And || Op == Instruction::Or ||
20636+
Op == Instruction::Xor || Op == Instruction::InsertElement)
2063720637
return false;
2063820638

2063920639
if (Inst.getType()->isScalableTy())

0 commit comments

Comments
 (0)