[llvm] [AMDGPU][GFX12] VOP encoding and codegen - add support for v_cvt fp8/… (PR #78414)

Mariusz Sikora via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 18 12:10:25 PST 2024


================
@@ -8273,6 +8276,16 @@ void AMDGPUAsmParser::cvtVOP3(MCInst &Inst, const OperandVector &Operands,
     ((AMDGPUOperand &)*Operands[I++]).addRegOperands(Inst, 1);
   }
 
+  if (isVOP1Cvt_F32_Fp8_Bf8_e64(Opc) &&
+      Opc != AMDGPU::V_CVT_PK_F32_BF8_e64_gfx12 &&
+      Opc != AMDGPU::V_CVT_PK_F32_FP8_e64_gfx12) {
+    AMDGPUOperand &Op = ((AMDGPUOperand &)*Operands[I++]);
+    Op.addRegOrImmWithFPInputModsOperands(Inst, 1); // src0
+    // Add dummy src1
+    Inst.addOperand(MCOperand::createImm(0));
+    Inst.addOperand(MCOperand::createReg(AMDGPU::getMCReg(0, getSTI())));
----------------
mariusz-sikora-at-amd wrote:

Yes, I think we can remove `getMCReg()`. I will change in other places also.

We will need these dummy operands when doing `cvtVOP3P` here: https://github.com/llvm/llvm-project/blob/99cae9a44fca4cfbd6ee82f196051cbdf6571fa1/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp#L8414 . Without them we will crash on out-of-bound access.

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


More information about the llvm-commits mailing list