A potential bug in helper function "fieldFromInstruction" in tablegen'erated file "XXXGenDisassemblerTables.inc"

Helper function:

template<typename InsnType>
static InsnType fieldFromInstruction(InsnType insn, unsigned startBit,
                                     unsigned numBits) {
    assert(startBit + numBits <= (sizeof(InsnType)*8) &&
           "Instruction field out of bounds!");
    InsnType fieldMask;
    if (numBits == sizeof(InsnType)*8)
      fieldMask = (InsnType)(-1LL);
    else
      fieldMask = ((1 << numBits) - 1) << startBit;
    return (insn & fieldMask) >> startBit;
}

may fail if the last parameter "startBit" is larger than 31 which is
likely to occur when instruction sets have encodings more than 32
bits.

In "else" statement, RHS is evaluated on 32-bit integers, and thus
might result in decoding errors in 32-bit platforms.

Yongyong, fixed in r171101. Thanks for your reporting!

...Takumi