OSDN Git Service

target-sh4: improve shad instruction
authorAurelien Jarno <aurelien@aurel32.net>
Sun, 5 Jul 2015 20:39:03 +0000 (22:39 +0200)
committerAurelien Jarno <aurelien@aurel32.net>
Sun, 13 Sep 2015 21:08:51 +0000 (23:08 +0200)
commitbe654c83608eaba199ed45444debf2dd46a88fe6
treef28edfc65b7136ff1c660f7a0b98e82a234987ae
parent577601616dea10db10a716de1be448f8564076f4
target-sh4: improve shad instruction

The SH4 shad instruction can shift in both direction, depending on the
sign of the shift. This is currently implemented using branches, which
is not really efficient and prevents the optimizer to do its job. In
practice it is often used with a constant loaded in a register just
before.

Simplify the implementation by computing both the value shifted to the
left and to the right, and then selecting the correct one with a
movcond. As with a negative value the shift amount can go up to 32 which
is undefined, we shift the value in two steps.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
target-sh4/translate.c