[llvm] [RISCV][GISEL] instruction-select for G_SPLAT_VECTOR (PR #111193)

Thorsten Schütt via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 11 12:23:00 PDT 2024


tschuett wrote:

```
void RISCVInstructionSelector::renderImm(MachineInstrBuilder &MIB,
                                         const MachineInstr &MI,
                                         int OpIdx) const {
  assert(MI.getOpcode() == TargetOpcode::G_CONSTANT && OpIdx == -1 &&
         "Expected G_CONSTANT");
  int64_t CstVal = MI.getOperand(1).getCImm()->getSExtValue();
  MIB.addImm(CstVal);
}
```
Why must `MI` be a G_CONSTANT? Couldn't it be instead a RISCV::IConstant (sorry for the bad name)? To avoid building G_X in the instruction selector.

https://github.com/llvm/llvm-project/pull/111193


More information about the llvm-commits mailing list