Skip to content

Commit

Permalink
target-ppc: Bug Fix: srad
Browse files Browse the repository at this point in the history
Fix the check for carry in the srad helper to properly construct
the mask -- a "1ULL" must be used (instead of "1") in order to
get the desired result.

Example:

R3 8000000000000000
R4 F3511AD4A2CD4C38
srad 3,3,4

Should *not* set XER[CA] but does without this patch.

Signed-off-by: Tom Musta <tommusta@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
  • Loading branch information
Tom Musta authored and agraf committed Sep 8, 2014
1 parent 34a0fad commit 4bc02e2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion target-ppc/int_helper.c
Expand Up @@ -248,7 +248,7 @@ target_ulong helper_srad(CPUPPCState *env, target_ulong value,
if (likely((uint64_t)shift != 0)) {
shift &= 0x3f;
ret = (int64_t)value >> shift;
if (likely(ret >= 0 || (value & ((1 << shift) - 1)) == 0)) {
if (likely(ret >= 0 || (value & ((1ULL << shift) - 1)) == 0)) {
env->ca = 0;
} else {
env->ca = 1;
Expand Down

0 comments on commit 4bc02e2

Please sign in to comment.