target-s390x: fix CC computation for LOAD POSITIVE instructions
authorAurelien Jarno <aurelien@aurel32.net>
Mon, 18 May 2015 13:39:58 +0000 (15:39 +0200)
committerAlexander Graf <agraf@suse.de>
Thu, 4 Jun 2015 23:37:57 +0000 (01:37 +0200)
LOAD POSITIVE instructions (LPR, LPGR and LPGFR) set the following
condition code:
  0: Result zero; no overflow
  1: --
  2: Result greater than zero; no overflow
  3: Overflow

The current code wrongly returns 1 instead of 2 in case of a result
greater than 0. This patches fixes that. This fixes the marshalling of
the value '0L' in Python.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Alexander Graf <agraf@suse.de>
target-s390x/cc_helper.c

index 00bc883a8a7685331d47419dd23469aa7fd8b472..bfce3f1e600f70d04fcf665d0ee79325c1739fdf 100644 (file)
@@ -195,7 +195,7 @@ static uint32_t cc_calc_abs_64(int64_t dst)
     if ((uint64_t)dst == 0x8000000000000000ULL) {
         return 3;
     } else if (dst) {
-        return 1;
+        return 2;
     } else {
         return 0;
     }
@@ -296,7 +296,7 @@ static uint32_t cc_calc_abs_32(int32_t dst)
     if ((uint32_t)dst == 0x80000000UL) {
         return 3;
     } else if (dst) {
-        return 1;
+        return 2;
     } else {
         return 0;
     }