Skip to content

Commit

Permalink
target-s390x: fix CC computation for LOAD POSITIVE instructions
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
  • Loading branch information
aurel32 authored and agraf committed Jun 4, 2015
1 parent ee0d0be commit 2aaa194
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions target-s390x/cc_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 2aaa194

Please sign in to comment.