[PATCH] D155329: [TableGen][CodeEmitterGen] Add support for querying operand bit offsets
Ilya Leoshkevich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 17 01:38:02 PDT 2023
iii added inline comments.
================
Comment at: llvm/utils/TableGen/CodeEmitterGen.cpp:216
+ BitOffsetCase += " return " +
+ utostr(BI->getNumBits() - beginInstBit - 1) + ";\n";
+ BitOffsetCaseEmitted = true;
----------------
craig.topper wrote:
> If I'm reading this right, this is the offset from the MSB of the encoding to the MSB of the field? Which works for SystemZ because the encoding bytes are emitted in big endian, but would not be useful for a little endian target?
You are right, I thought that reverseBitsForLittleEndianEncoding() would handle that, but it doesn't.
I've updated the patch and verified the update with PPC, which sets isLittleEndianEncoding.
For BCCTR (https://www.ibm.com/docs/en/aix/7.2?topic=set-bcctr-bcc-branch-conditional-count-register-instruction) we get:
```
switch (OpNum) {
case 0:
// op: BI
return 20;
}
```
which matches the drawing and the encoding in practice:
```
0: 20 1c 22 4c bcctr 1, 2, 3
bit 20
|
v
BitV 00100000 00011100 00100010 01001100
Bit# 76543210 54321098 32109876 10987654
+++++++- ...--+++ +++----- ------++
Field 528 LK BH BO BI 19 BO
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155329/new/
https://reviews.llvm.org/D155329
More information about the llvm-commits
mailing list