git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364635
91177308-0d34-0410-b5e6-
96231b3b80d8
else if (!(Val & 0x80))
imm *= -1;
if (imm != INT32_MIN)
- imm <<= shift;
+ imm *= (1U << shift);
Inst.addOperand(MCOperand::createImm(imm));
return MCDisassembler::Success;
imm *= -1;
}
if (imm != INT32_MIN)
- imm <<= shift;
+ imm *= (1U << shift);
Inst.addOperand(MCOperand::createImm(imm));
return S;
// If the immediate is B bits long, we need B+1 bits in order
// to represent the (inverse of the) sign bit.
Value <<= (Bits + 1);
- int32_t tmp = (int32_t)MO2.getImm() >> Shift;
- if (tmp < 0)
+ int32_t tmp = (int32_t)MO2.getImm();
+ if (tmp == INT32_MIN) { // represents subtracting zero rather than adding it
+ tmp = 0;
+ } else if (tmp < 0) {
tmp = abs(tmp);
- else
+ } else {
Value |= (1U << Bits); // Set the ADD bit
- Value |= tmp & ((1U << Bits) - 1);
+ }
+ Value |= (tmp >> Shift) & ((1U << Bits) - 1);
return Value;
}