mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-02 07:11:49 +00:00
Fix undefined behavior (negation of INT_MIN) in ARM backend.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162520 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9e085a8637
commit
aaf217953b
@ -275,7 +275,7 @@ def imm16_31 : ImmLeaf<i32, [{
|
||||
|
||||
def so_imm_neg_asmoperand : AsmOperandClass { let Name = "ARMSOImmNeg"; }
|
||||
def so_imm_neg : Operand<i32>, PatLeaf<(imm), [{
|
||||
int64_t Value = -(int)N->getZExtValue();
|
||||
unsigned Value = -(unsigned)N->getZExtValue();
|
||||
return Value && ARM_AM::getSOImmVal(Value) != -1;
|
||||
}], imm_neg_XFORM> {
|
||||
let ParserMatchClass = so_imm_neg_asmoperand;
|
||||
|
@ -783,7 +783,7 @@ getT2Imm8s4OpValue(const MCInst &MI, unsigned OpIdx,
|
||||
|
||||
// Immediate is always encoded as positive. The 'U' bit controls add vs sub.
|
||||
if (Imm8 < 0)
|
||||
Imm8 = -Imm8;
|
||||
Imm8 = -(uint32_t)Imm8;
|
||||
|
||||
// Scaled by 4.
|
||||
Imm8 /= 4;
|
||||
|
Loading…
Reference in New Issue
Block a user