Skip to content

Commit

Permalink
[TableGen] Correct the shift to the proper bit width.
Browse files Browse the repository at this point in the history
- Replace the previous 32-bit shift with 64-bit one matching `OpInit`.

llvm-svn: 368513
  • Loading branch information
darkbuck committed Aug 10, 2019
1 parent 21c15ef commit 8a25eab
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions llvm/test/TableGen/FixedLenDecoderEmitter/InitValue.td
Expand Up @@ -28,8 +28,19 @@ def bar : Instruction {
let Inst{15-8} = factor{7-0};
}

def bax : Instruction {
let InOperandList = (ins i32imm:$factor);
field bits<16> Inst;
field bits<16> SoftFail = 0;
bits<33> factor;
let factor{32} = 1; // non-zero initial value
let Inst{15-8} = factor{32-25};
}

}

// CHECK: tmp = fieldFromInstruction(insn, 9, 7) << 1;
// CHECK: tmp = 0x1;
// CHECK: tmp |= fieldFromInstruction(insn, 9, 7) << 1;
// CHECK: tmp = 0x100000000;
// CHECK: tmp |= fieldFromInstruction(insn, 8, 7) << 25;
2 changes: 1 addition & 1 deletion llvm/utils/TableGen/FixedLenDecoderEmitter.cpp
Expand Up @@ -2038,7 +2038,7 @@ populateInstruction(CodeGenTarget &Target, const Record &EncodingDef,
for (unsigned I = 0; I < OpBits->getNumBits(); ++I)
if (const BitInit *OpBit = dyn_cast<BitInit>(OpBits->getBit(I)))
if (OpBit->getValue())
OpInfo.InitValue |= 1 << I;
OpInfo.InitValue |= 1ULL << I;

unsigned Base = ~0U;
unsigned Width = 0;
Expand Down

0 comments on commit 8a25eab

Please sign in to comment.