]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
target/s390x: Fix risbg handling
authorRichard Henderson <rth@twiddle.net>
Sat, 1 Jul 2017 20:20:24 +0000 (13:20 -0700)
committerRichard Henderson <rth@twiddle.net>
Mon, 17 Jul 2017 21:13:17 +0000 (14:13 -0700)
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>
target/s390x/translate.c

index b46f4c80132c0e301d0002bca97189b202ce29b2..1dffcee88436b17630c254f3ff97ad7b51be55f7 100644 (file)
@@ -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;
     }