x86emul: simplify SHLD/SHRD handling
authorJan Beulich <jbeulich@suse.com>
Fri, 23 Jun 2017 13:48:28 +0000 (15:48 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 23 Jun 2017 13:48:28 +0000 (15:48 +0200)
commit4e59f578cb75f87182bb57d7a2c2df73ff2262bc
treee5de4860f48f0c07632b5bdd8cb03771a74feb10
parent579d698da608a24ab334a6a38d932176bac5cecd
x86emul: simplify SHLD/SHRD handling

First of all there's no point considering the "shift == width" case,
when immediately before that check we mask "shift" by "width - 1". And
then truncate_word() use can be reduced too: dst.val, as obtained by
generic operand fetching code, is already suitably truncated, and its
use can also be made symmetric in the main conditional expression (on
only left shift results). Finally masking the result of a right shift
is not necessary when the left hand operand doesn't have more than
"width" significant bits.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/x86_emulate/x86_emulate.c