From patchwork Thu Sep 4 17:20:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 385952 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 1309B140189 for ; Fri, 5 Sep 2014 03:39:23 +1000 (EST) Received: from localhost ([::1]:53025 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPb0D-0003yi-1d for incoming@patchwork.ozlabs.org; Thu, 04 Sep 2014 13:39:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39763) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPaiR-0004FZ-5M for qemu-devel@nongnu.org; Thu, 04 Sep 2014 13:21:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XPaiF-0005n2-0V for qemu-devel@nongnu.org; Thu, 04 Sep 2014 13:20:59 -0400 Received: from cantor2.suse.de ([195.135.220.15]:43885 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPaiE-0005gf-Iw; Thu, 04 Sep 2014 13:20:46 -0400 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id E7BB7AD87; Thu, 4 Sep 2014 17:20:45 +0000 (UTC) From: Alexander Graf To: qemu-ppc@nongnu.org Date: Thu, 4 Sep 2014 19:20:21 +0200 Message-Id: <1409851240-48126-34-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1409851240-48126-1-git-send-email-agraf@suse.de> References: <1409851240-48126-1-git-send-email-agraf@suse.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 195.135.220.15 Cc: peter.maydell@linaro.org, qemu-devel@nongnu.org, Tom Musta Subject: [Qemu-devel] [PULL 33/52] target-ppc: Bug Fix: srad X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Tom Musta 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 Signed-off-by: Alexander Graf --- target-ppc/int_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target-ppc/int_helper.c b/target-ppc/int_helper.c index e83a25d..e5b103b 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;