Allow assembly code (either in an asm file or inline asm) to have negative
offsets for ADD/SUB, and convert them to their inverse instructions as per
the ARMv8 Instruction Set Overview, section 5.4.1.
I'm not really sure of a few things:
- If I accept negative numbers in isAddSubImm(), will this break other stuff?
- The manual doesn't say specifically, but I'm assuming we can't swap ADDS/SUBS.
- The error message may not be in the best of places, nor the best of texts. I'm open to suggestions.
- Is this really the best way to modify the MCInst?
- Adding support for #-4096 and higher powers of two may be trivial. I'll check while this review goes on.
- Changing the parser like this seems a lot better than both printers (as I had in bugzilla).
Fixes PR20978.
The immediate form, we probably can. As I recall the edge cases where the transformation is invalid occur when the RHS is U?INT_(MIN|MAX). The shifted 12-bit immediates never are, so it should be OK.