[llvm] [RISCV][GISel] Instruction select for vector G_ADD, G_SUB (PR #74114)
Jiahan Xie via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 6 06:58:35 PST 2023
jiahanxie353 wrote:
To implement `RISCVInstructionSelector::getRegClassForTypeOnBank`, I'm creating a mapping function that takes in an `LLT` and output `RegClass`.
Let's take `vscale x 1 x s32` as an example `LLT`, the expected `RegClass` is `RISCV::VRRegClassID` (the reason being we treat `LMUL` <= 1 all as `LMUL`=1 since they have similar behavior, if I remember our discussion from yesterday correctly? @michaelmaitland ).
I was trying to use `getElementType` to extract `s32`, and using `getNumElements()` to extract that `1`, which raises an exception. And I believe it's because `getNumElements()` extracts `vscale` and `1` at the same time. Since `vscale` is unknown at compile time, so it can't calculate the exact `NumElements`.
I'm wondering if I'm on the right track, and is there a generic function to extract `n` out of `vscale x n x m`?
https://github.com/llvm/llvm-project/pull/74114
More information about the llvm-commits
mailing list