arm64 front end: ufbm/sfbm: handle plain shifts explicitly
commit41504d33dec8773c591d45192d1dda6e9c670031
authorJulian Seward <jseward@acm.org>
Thu, 17 Dec 2020 16:40:46 +0000 (17 17:40 +0100)
committerJulian Seward <jseward@acm.org>
Thu, 17 Dec 2020 16:40:46 +0000 (17 17:40 +0100)
tree3bd2ec9a86310ebe2d4f36ad35bd617b3171d026
parent04cdc29b007594a0e58ffef0c9dd87df3ea595ea
arm64 front end: ufbm/sfbm: handle plain shifts explicitly

The ufbm and sfbm instructions implement some kind of semi-magical rotate,
mask and sign/zero-extend functionality.  Boring old left and right shifts are
special cases of it.  The existing translation into IR is correct, but has the
disadvantage that the IR optimiser isn't clever enough to simplify the
resulting IR back into a single shift in the case where the instruction is
used simply to encode a shift.  This induces inefficiency and it also makes
the resulting disassembly pretty difficult to read, if you're into that kind
of thing.

This commit does the obvious thing: detects cases where the required behaviour
is just a single shift, and emits IR and disassembly-printing accordingly.
All other cases fall through to the existing general-case handling and so are
unchanged.
VEX/priv/guest_arm64_toIR.c