[llvm] [RISC-V][GISEL] Select G_BITCAST for scalable vectors (PR #101486)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 23 14:54:23 PDT 2024
================
@@ -785,6 +786,26 @@ void RISCVInstructionSelector::preISelLower(MachineInstr &MI,
replacePtrWithInt(MI.getOperand(1), MIB, MRI);
MI.setDesc(TII.get(TargetOpcode::G_AND));
MRI.setType(DstReg, sXLen);
+ break;
+ }
+ case TargetOpcode::G_LOAD: {
+ Register DstReg = MI.getOperand(0).getReg();
+ const LLT DstTy = MRI.getType(DstReg);
+ if (!(DstTy.isVector() && DstTy.getElementType().isPointer()))
+ break;
+ const LLT sXLen = LLT::scalar(STI.getXLen());
+ MRI.setType(DstReg, LLT::scalable_vector(DstTy.getElementCount().getKnownMinValue(), sXLen));
+ break;
+ }
+ case TargetOpcode::G_STORE: {
+ MachineOperand &SrcOp = MI.getOperand(0);
+ const LLT SrcTy = MRI.getType(SrcOp.getReg());
+ if (!(SrcTy.isVector() && SrcTy.getElementType().isPointer()))
+ break;
+ const LLT sXLen = LLT::scalar(STI.getXLen());
+ auto Copy = MIB.buildCopy(LLT::scalable_vector(SrcTy.getElementCount().getKnownMinValue(), sXLen), SrcOp);
----------------
topperc wrote:
the pointer has p0 type. we need to change the type of the data to store, but that type is owned by the instruction that produces the data. so you can't change it.
https://github.com/llvm/llvm-project/pull/101486
More information about the llvm-commits
mailing list