summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2017-07-01 13:20:24 -0700
committerRichard Henderson <rth@twiddle.net>2017-07-17 14:13:17 -0700
commitdbdaaff43adc49f1debd935b1fd58e2b47ba7676 (patch)
tree08f72aac883850d727d4530dfa0a9ee8b3bd91e0
parent19d70587b59f7879a0315a6d98c2409957154351 (diff)
downloadfocaccia-qemu-dbdaaff43adc49f1debd935b1fd58e2b47ba7676.tar.gz
focaccia-qemu-dbdaaff43adc49f1debd935b1fd58e2b47ba7676.zip
target/s390x: Fix risbg handling
The rotation is to the left, but extract shifts to the right.
The computation of the extract parameters needs adjusting.

For the entry condition, simplify

	64 - rot + len <= 64
	-rot + len <= 0
	len <= rot

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Reported-by: David Hildenbrand <david@redhat.com>
Suggested-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
-rw-r--r--target/s390x/translate.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/target/s390x/translate.c b/target/s390x/translate.c
index b46f4c8013..1dffcee884 100644
--- a/target/s390x/translate.c
+++ b/target/s390x/translate.c
@@ -3479,8 +3479,8 @@ static ExitStatus op_risbg(DisasContext *s, DisasOps *o)
     }
 
     /* In some cases we can implement this with extract.  */
-    if (imask == 0 && pos == 0 && len > 0 && rot + len <= 64) {
-        tcg_gen_extract_i64(o->out, o->in2, rot, len);
+    if (imask == 0 && pos == 0 && len > 0 && len <= rot) {
+        tcg_gen_extract_i64(o->out, o->in2, 64 - rot, len);
         return NO_EXIT;
     }