[llvm] [Tablegen] Don't emit decoder tables with islands larger than 64 bits (PR #179651)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 4 05:01:00 PST 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-tablegen
Author: Petr Vesely (veselypeta)
<details>
<summary>Changes</summary>
I have a downstream target which has 128-bit instructions where some instructions can have large sections of encoding to be determined ahead of time. This results in the island calculations for decoder tables to emit checks over 64-bits.
This change will emit multiple separate checks when the island exceeds 64-bits.
---
Full diff: https://github.com/llvm/llvm-project/pull/179651.diff
1 Files Affected:
- (modified) llvm/utils/TableGen/DecoderEmitter.cpp (+8-2)
``````````diff
diff --git a/llvm/utils/TableGen/DecoderEmitter.cpp b/llvm/utils/TableGen/DecoderEmitter.cpp
index 5d41b7dc3c311..664c3009ff504 100644
--- a/llvm/utils/TableGen/DecoderEmitter.cpp
+++ b/llvm/utils/TableGen/DecoderEmitter.cpp
@@ -656,8 +656,14 @@ static std::vector<EncodingIsland> getIslands(const KnownBits &EncodingBits,
if (!IsFiltered && IsKnown) {
if (OnIsland) {
// Accumulate island bits.
- FieldVal |= static_cast<uint64_t>(EncodingBits.One[I])
- << (I - StartBit);
+ const unsigned BitNo = I - StartBit;
+ FieldVal |= static_cast<uint64_t>(EncodingBits.One[I]) << (BitNo);
+ // If island becomes larger than 64-bits complete the island and start a
+ // new one
+ if (BitNo >= 63) {
+ Islands.push_back({StartBit, 64, FieldVal});
+ OnIsland = false;
+ }
} else {
// Onto an island.
StartBit = I;
``````````
</details>
https://github.com/llvm/llvm-project/pull/179651
More information about the llvm-commits
mailing list