[mips][ias] fix li macro when values are negated with ~
authorSimon Dardis <simon.dardis@imgtec.com>
Wed, 5 Oct 2016 18:26:19 +0000 (18:26 +0000)
committerSimon Dardis <simon.dardis@imgtec.com>
Wed, 5 Oct 2016 18:26:19 +0000 (18:26 +0000)
commit299dbd6cd15807d154cc91b7748b73da5adf0bda
tree67bc9ba298c41af882b0cbc16ae2aa67f20a3fa3
parent36e21a3d56d48ec16044f1cc7e4ea903bb0a1216
[mips][ias] fix li macro when values are negated with ~

The integrated assembler evaluates the expressions such as ~0x80000000 to
0xffffffff7fffffff early in the parsing process. This patch adds compatibility
with gas so that li loads the expected value (0x7fffffff) in those cases. This
only occurs iff all the upper 32bits are set and maintains existing checks by
not truncating the result down to 32 bits if any of the the upper bits are not
set.

Reviewers: dsanders, zoran.jovanovic

Differential Review: https://reviews.llvm.org/D23399

llvm-svn: 283353
llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
llvm/lib/Target/Mips/MipsInstrInfo.td
llvm/test/MC/Mips/macro-li-bad.s
llvm/test/MC/Mips/macro-li.s