[PATCH] D157624: [AMDGPU] Treat KIMM32 and KIMM16 operand types as noninlinable

Mirko Brkusanin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 10 07:58:52 PDT 2023


mbrkusanin created this revision.
mbrkusanin added reviewers: foad, Joe_Nash, arsenm.
mbrkusanin added a project: LLVM.
Herald added subscribers: StephenFan, kerbowa, hiraditya, tpr, dstuttard, yaxunl, jvesely, kzhuravl.
Herald added a project: All.
mbrkusanin requested review of this revision.
Herald added a subscriber: wdng.

While they are 32bit literals they are already included in encoding of the
instructions that use them and do not increase the size of the instruction from
their base size.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D157624

Files:
  llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
  llvm/test/CodeGen/AMDGPU/code-size-estimate.ll


Index: llvm/test/CodeGen/AMDGPU/code-size-estimate.ll
===================================================================
--- llvm/test/CodeGen/AMDGPU/code-size-estimate.ll
+++ llvm/test/CodeGen/AMDGPU/code-size-estimate.ll
@@ -149,6 +149,7 @@
 
 ; GFX9: codeLenInByte = 24
 ; GFX10: codeLenInByte = 20
+; GFX11: codeLenInByte = 20
 
 define float @v_mul_f32_vop2_frame_index(float %x) {
 ; GFX9-LABEL: v_mul_f32_vop2_frame_index:
Index: llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
+++ llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
@@ -3906,6 +3906,7 @@
   }
   case AMDGPU::OPERAND_KIMM32:
   case AMDGPU::OPERAND_KIMM16:
+    return false;
   case AMDGPU::OPERAND_INPUT_MODS:
   case MCOI::OPERAND_IMMEDIATE:
     // Always embedded in the instruction for free.
@@ -7818,7 +7819,9 @@
     for (int I = 0, E = MI.getNumExplicitOperands(); I != E; ++I) {
       const MachineOperand &Op = MI.getOperand(I);
       const MCOperandInfo &OpInfo = Desc.operands()[I];
-      if (!Op.isReg() && !isInlineConstant(Op, OpInfo)) {
+      if (!Op.isReg() && !isInlineConstant(Op, OpInfo) &&
+          OpInfo.OperandType != AMDGPU::OPERAND_KIMM16 &&
+          OpInfo.OperandType != AMDGPU::OPERAND_KIMM32) {
         HasLiteral = true;
         break;
       }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157624.549044.patch
Type: text/x-patch
Size: 1352 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230810/7aff6a50/attachment.bin>


More information about the llvm-commits mailing list