summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorTom Musta <tommusta@gmail.com>2014-08-12 08:45:10 -0500
committerAlexander Graf <agraf@suse.de>2014-09-08 12:50:51 +0200
commit4bc02e230d1e0fd41d2a892d81dcad56e3b3702d (patch)
treeeb17fa63dd1aa3c834e4d0c8a7a01994f2d261c8
parent34a0fad10210a3e639a8e68323c923494047eefc (diff)
downloadfocaccia-qemu-4bc02e230d1e0fd41d2a892d81dcad56e3b3702d.tar.gz
focaccia-qemu-4bc02e230d1e0fd41d2a892d81dcad56e3b3702d.zip
target-ppc: Bug Fix: srad
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>
-rw-r--r--target-ppc/int_helper.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/target-ppc/int_helper.c b/target-ppc/int_helper.c
index e83a25d05a..e5b103b0ec 100644
--- a/target-ppc/int_helper.c
+++ b/target-ppc/int_helper.c
@@ -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;