mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-18 22:26:16 +00:00
[RISCV] Fix crash when legalizing mgather/scatter on rv32
This is a fix for a subset of legalization problems around 64 bit indices on rv32 targets. For RV32+V, we were using the wrong mask type for the manual truncation lowering for fixed length vectors. Instead, just use the generic TRUNCATE node, and let it be lowered as needed. Note that legalization is still broken for rv32+zve32. That appears to be a different issue.
This commit is contained in:
parent
38c59b9f53
commit
13a74d6cc8
@ -10116,10 +10116,7 @@ SDValue RISCVTargetLowering::lowerMaskedGather(SDValue Op,
|
||||
|
||||
if (XLenVT == MVT::i32 && IndexVT.getVectorElementType().bitsGT(XLenVT)) {
|
||||
IndexVT = IndexVT.changeVectorElementType(XLenVT);
|
||||
SDValue TrueMask = DAG.getNode(RISCVISD::VMSET_VL, DL, Mask.getValueType(),
|
||||
VL);
|
||||
Index = DAG.getNode(RISCVISD::TRUNCATE_VECTOR_VL, DL, IndexVT, Index,
|
||||
TrueMask, VL);
|
||||
Index = DAG.getNode(ISD::TRUNCATE, DL, IndexVT, Index);
|
||||
}
|
||||
|
||||
unsigned IntID =
|
||||
@ -10218,10 +10215,7 @@ SDValue RISCVTargetLowering::lowerMaskedScatter(SDValue Op,
|
||||
|
||||
if (XLenVT == MVT::i32 && IndexVT.getVectorElementType().bitsGT(XLenVT)) {
|
||||
IndexVT = IndexVT.changeVectorElementType(XLenVT);
|
||||
SDValue TrueMask = DAG.getNode(RISCVISD::VMSET_VL, DL, Mask.getValueType(),
|
||||
VL);
|
||||
Index = DAG.getNode(RISCVISD::TRUNCATE_VECTOR_VL, DL, IndexVT, Index,
|
||||
TrueMask, VL);
|
||||
Index = DAG.getNode(ISD::TRUNCATE, DL, IndexVT, Index);
|
||||
}
|
||||
|
||||
unsigned IntID =
|
||||
|
Loading…
x
Reference in New Issue
Block a user