OSDN Git Service

ARM: Fix another regression introduced in r223113
authorAsiri Rathnayake <asiri.rathnayake@arm.com>
Thu, 12 Feb 2015 13:37:28 +0000 (13:37 +0000)
committerAsiri Rathnayake <asiri.rathnayake@arm.com>
Thu, 12 Feb 2015 13:37:28 +0000 (13:37 +0000)
commitb0d513e1ebdf49230467047fb10e1cc5ad5f1ecc
treefce7b9e92f775bd6e2381d2caa18e6e2a00edebf
parent95fa2f93265ff2efddd05a52897247acacca34a2
ARM: Fix another regression introduced in r223113

The changes in r223113 (ARM modified-immediate syntax) have broken
instructions like:
  mov r0, #~0xffffff00
The problem is that I've added a spurious range check on the immediate
operand to ensure that it lies between INT32_MIN and UINT32_MAX. While
this range check is correct in theory, it causes problems because the
operand is stored in an int64_t (by MC). So valid 32-bit constants like
\#~0xffffff00 become out of range. The solution is to simply remove this
range check. It is not possible to validate the range of the immediate
operand with the current setup because: 1) The operand is stored in an
int64_t by MC, 2) The immediate can be of the forms #imm, #-imm, #~imm
or even #((~imm)) etc. So we just chop the value to 32 bits and use it.

Also noted that the original range check was note tested by any of the
unit tests. I've added a new test to cover #~imm kind of operands.

Change-Id: I411e90d84312a2eff01b732bb238af536c4a7599

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228920 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/ARM/AsmParser/ARMAsmParser.cpp
test/MC/ARM/basic-arm-instructions.s