[llvm] r368513 - [TableGen] Correct the shift to the proper bit width.
Michael Liao via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 10 09:15:06 PDT 2019
Author: hliao
Date: Sat Aug 10 09:15:06 2019
New Revision: 368513
URL: http://llvm.org/viewvc/llvm-project?rev=368513&view=rev
Log:
[TableGen] Correct the shift to the proper bit width.
- Replace the previous 32-bit shift with 64-bit one matching `OpInit`.
Modified:
llvm/trunk/test/TableGen/FixedLenDecoderEmitter/InitValue.td
llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp
Modified: llvm/trunk/test/TableGen/FixedLenDecoderEmitter/InitValue.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/FixedLenDecoderEmitter/InitValue.td?rev=368513&r1=368512&r2=368513&view=diff
==============================================================================
--- llvm/trunk/test/TableGen/FixedLenDecoderEmitter/InitValue.td (original)
+++ llvm/trunk/test/TableGen/FixedLenDecoderEmitter/InitValue.td Sat Aug 10 09:15:06 2019
@@ -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;
Modified: llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp?rev=368513&r1=368512&r2=368513&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp Sat Aug 10 09:15:06 2019
@@ -2038,7 +2038,7 @@ populateInstruction(CodeGenTarget &Targe
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;
More information about the llvm-commits
mailing list