[llvm] [AMDGPU][True16][CodeGen] FLAT_load using D16 pseudo instruction (PR #114500)

Joe Nash via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 13 07:53:28 PST 2025


================
@@ -113,9 +113,50 @@ bool AMDGPUMCInstLower::lowerOperand(const MachineOperand &MO,
   llvm_unreachable("unknown operand type");
 }
 
-void AMDGPUMCInstLower::lower(const MachineInstr *MI, MCInst &OutMI) const {
+// Lower true16 D16 Opcode to d16_lo/d16_hi MCInst base on Dst/Data's .l/.h
+// selection
+void AMDGPUMCInstLower::lowerT16D16Helper(const MachineInstr *MI,
+                                          MCInst &OutMI) const {
   unsigned Opcode = MI->getOpcode();
   const auto *TII = static_cast<const SIInstrInfo*>(ST.getInstrInfo());
+  const SIRegisterInfo &TRI = TII->getRegisterInfo();
+  const auto *Info = AMDGPU::getT16D16Helper(Opcode);
+
+  // select Dst/Data
+  int VDataIdx = AMDGPU::getNamedOperandIdx(Opcode, AMDGPU::OpName::vdata);
+  int VDstOrVDataIdx = VDataIdx != -1 ? VDataIdx : 0;
+  MachineOperand MIVDstOrVData = MI->getOperand(VDstOrVDataIdx);
----------------
Sisyph wrote:

```suggestion
  MachineOperand& MIVDstOrVData = MI->getOperand(VDstOrVDataIdx);
```

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


More information about the llvm-commits mailing list