From patchwork Sat Mar 7 14:43:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Weil X-Patchwork-Id: 447585 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 4A35E140134 for ; Sun, 8 Mar 2015 01:44:02 +1100 (AEDT) Received: from localhost ([::1]:34851 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YUFxO-00018n-AS for incoming@patchwork.ozlabs.org; Sat, 07 Mar 2015 09:43:58 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50603) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YUFx8-0000s8-2r for qemu-devel@nongnu.org; Sat, 07 Mar 2015 09:43:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YUFx6-0002lt-Rr for qemu-devel@nongnu.org; Sat, 07 Mar 2015 09:43:42 -0500 Received: from qemu.weilnetz.de ([2a03:4000:2:362::1]:34388) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YUFx6-0002ib-Kt for qemu-devel@nongnu.org; Sat, 07 Mar 2015 09:43:40 -0500 Received: by qemu.weilnetz.de (Postfix, from userid 1000) id A4F9417F989; Sat, 7 Mar 2015 15:43:37 +0100 (CET) From: Stefan Weil To: QEMU Developer Date: Sat, 7 Mar 2015 15:43:32 +0100 Message-Id: <1425739412-8144-1-git-send-email-sw@weilnetz.de> X-Mailer: git-send-email 1.7.10.4 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a03:4000:2:362::1 Cc: Peter Maydell , Bastian Koppelmann , Stefan Weil Subject: [Qemu-devel] [PATCH v2] target-tricore: Fix two helper functions (clang warnings) 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 clang report: target-tricore/op_helper.c:1247:24: warning: taking the absolute value of unsigned type 'uint32_t' (aka 'unsigned int') has no effect [-Wabsolute-value] target-tricore/op_helper.c:1248:25: warning: taking the absolute value of unsigned type 'uint32_t' (aka 'unsigned int') has no effect [-Wabsolute-value] target-tricore/op_helper.c:1249:19: warning: taking the absolute value of unsigned type 'uint32_t' (aka 'unsigned int') has no effect [-Wabsolute-value] target-tricore/op_helper.c:1297:24: warning: taking the absolute value of unsigned type 'uint32_t' (aka 'unsigned int') has no effect [-Wabsolute-value] target-tricore/op_helper.c:1298:25: warning: taking the absolute value of unsigned type 'uint32_t' (aka 'unsigned int') has no effect [-Wabsolute-value] target-tricore/op_helper.c:1299:19: warning: taking the absolute value of unsigned type 'uint32_t' (aka 'unsigned int') has no effect [-Wabsolute-value] Fix also the divisor which was taken from the wrong register (thanks to Peter Maydell for this hint). Cc: Bastian Koppelmann Signed-off-by: Stefan Weil --- v2 adds the fix for the wrong register. Stefan target-tricore/op_helper.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/target-tricore/op_helper.c b/target-tricore/op_helper.c index ed26b30..52ad80b 100644 --- a/target-tricore/op_helper.c +++ b/target-tricore/op_helper.c @@ -1244,9 +1244,9 @@ uint64_t helper_dvinit_b_13(CPUTriCoreState *env, uint32_t r1, uint32_t r2) quotient_sign = 1; } - abs_sig_dividend = abs(r1) >> 7; - abs_base_dividend = abs(r1) & 0x7f; - abs_divisor = abs(r1); + abs_sig_dividend = abs((int32_t)r1) >> 7; + abs_base_dividend = abs((int32_t)r1) & 0x7f; + abs_divisor = abs((int32_t)r2); /* calc overflow */ env->PSW_USB_V = 0; if ((quotient_sign) && (abs_divisor)) { @@ -1294,9 +1294,9 @@ uint64_t helper_dvinit_h_13(CPUTriCoreState *env, uint32_t r1, uint32_t r2) quotient_sign = 1; } - abs_sig_dividend = abs(r1) >> 7; - abs_base_dividend = abs(r1) & 0x7f; - abs_divisor = abs(r1); + abs_sig_dividend = abs((int32_t)r1) >> 7; + abs_base_dividend = abs((int32_t)r1) & 0x7f; + abs_divisor = abs((int32_t)r2); /* calc overflow */ env->PSW_USB_V = 0; if ((quotient_sign) && (abs_divisor)) {