[llvm] [RISCV][GISEL] Legalize G_VSCALE (PR #85967)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 25 12:12:10 PDT 2024
================
@@ -1699,6 +1699,36 @@ LegalizerHelper::LegalizeResult LegalizerHelper::narrowScalar(MachineInstr &MI,
case TargetOpcode::G_FLDEXP:
case TargetOpcode::G_STRICT_FLDEXP:
return narrowScalarFLDEXP(MI, TypeIdx, NarrowTy);
+ case TargetOpcode::G_VSCALE: {
+ LLT Ty = MRI.getType(MI.getOperand(0).getReg());
+ const APInt &Val = MI.getOperand(1).getCImm()->getValue();
+ unsigned TotalSize = Ty.getSizeInBits();
+ unsigned NarrowSize = NarrowTy.getSizeInBits();
+ int NumParts = TotalSize / NarrowSize;
+
+ SmallVector<Register, 4> PartRegs;
----------------
topperc wrote:
This doesn't look right to me. Looks like you're just creating a G_VSCALE for each part using just the bits of the constant that belong to that part. G_VSCALE is a multiply, the full multiply result of the first part produce a 2x result. The second half of that full product needs to added to the second part.
https://github.com/llvm/llvm-project/pull/85967
More information about the llvm-commits
mailing list