On 11 December 2017 at 14:49, Marc Zyngier <marc.zyngier@xxxxxxx> wrote: > We lack a way to encode operations such as AND, ORR, EOR that take > an immediate value. Doing so is quite involved, and is all about > reverse engineering the decoding algorithm described in the > pseudocode function DecodeBitMasks(). Is it possible to borrow the existing tested implementation which a compiler surely must have for this, rather than having to reinvent this rather complicated wheel? Here's LLVM's version: https://github.com/llvm-mirror/llvm/blob/93e6e5414ded14bcbb233baaaa5567132fee9a0c/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h#L209 (confirming that the LLVM license is GPLv2 compatible is left as an exercise for the reader, but I'm pretty sure it is) PS: typo in subject: 'literal'. thanks -- PMM