]> granicus.if.org Git - llvm/commitdiff
[TableGen] Correct the shift to the proper bit width.
authorMichael Liao <michael.hliao@gmail.com>
Sat, 10 Aug 2019 16:15:06 +0000 (16:15 +0000)
committerMichael Liao <michael.hliao@gmail.com>
Sat, 10 Aug 2019 16:15:06 +0000 (16:15 +0000)
- Replace the previous 32-bit shift with 64-bit one matching `OpInit`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368513 91177308-0d34-0410-b5e6-96231b3b80d8

test/TableGen/FixedLenDecoderEmitter/InitValue.td
utils/TableGen/FixedLenDecoderEmitter.cpp

index 27058baa73c09beac8b0d7dc7a15885437d70a11..2ed3f1343b4b1d8a0a03dde5237ceb661efa10f8 100644 (file)
@@ -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;
index 7a6f44b9ab6ea647258e667452d0d03529529fd7..cfe06dd4d7fb54b1d30dda0e69d896584c95933d 100644 (file)
@@ -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;