[PATCH] D113318: [AMDGPU] Make getInstSizeInBytes more generic
Joe Nash via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 8 07:55:03 PST 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG79f52af4cd9a: [AMDGPU] Make getInstSizeInBytes more generic (authored by Joe_Nash).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113318/new/
https://reviews.llvm.org/D113318
Files:
llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
Index: llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
+++ llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
@@ -3471,6 +3471,9 @@
uint32_t Trunc = static_cast<uint32_t>(Imm);
return AMDGPU::isInlinableLiteralV216(Trunc, ST.hasInv2PiInlineImm());
}
+ case AMDGPU::OPERAND_KIMM32:
+ case AMDGPU::OPERAND_KIMM16:
+ return false;
default:
llvm_unreachable("invalid bitwidth");
}
@@ -7307,31 +7310,19 @@
return Size;
}
- // 4-byte instructions may have a 32-bit literal encoded after them. Check
- // operands that coud ever be literals.
+ // Instructions may have a 32-bit literal encoded after them. Check
+ // operands that could ever be literals.
if (isVALU(MI) || isSALU(MI)) {
- int Src0Idx = AMDGPU::getNamedOperandIdx(Opc, AMDGPU::OpName::src0);
- if (Src0Idx == -1)
- return DescSize; // No operands.
-
- if (isLiteralConstantLike(MI.getOperand(Src0Idx), Desc.OpInfo[Src0Idx]))
- return isVOP3(MI) ? 12 : (DescSize + 4);
-
- int Src1Idx = AMDGPU::getNamedOperandIdx(Opc, AMDGPU::OpName::src1);
- if (Src1Idx == -1)
- return DescSize;
-
- if (isLiteralConstantLike(MI.getOperand(Src1Idx), Desc.OpInfo[Src1Idx]))
- return isVOP3(MI) ? 12 : (DescSize + 4);
-
- int Src2Idx = AMDGPU::getNamedOperandIdx(Opc, AMDGPU::OpName::src2);
- if (Src2Idx == -1)
+ if (isDPP(MI))
return DescSize;
-
- if (isLiteralConstantLike(MI.getOperand(Src2Idx), Desc.OpInfo[Src2Idx]))
- return isVOP3(MI) ? 12 : (DescSize + 4);
-
- return DescSize;
+ bool HasLiteral = false;
+ for (int I = 0, E = MI.getNumExplicitOperands(); I != E; ++I) {
+ if (isLiteralConstant(MI, I)) {
+ HasLiteral = true;
+ break;
+ }
+ }
+ return HasLiteral ? DescSize + 4 : DescSize;
}
// Check whether we have extra NSA words.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113318.385502.patch
Type: text/x-patch
Size: 1930 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211108/10631c1e/attachment.bin>
More information about the llvm-commits
mailing list