From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38842) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YUEsm-0005SA-2k for qemu-devel@nongnu.org; Sat, 07 Mar 2015 08:35:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YUEsi-0001Eu-Tr for qemu-devel@nongnu.org; Sat, 07 Mar 2015 08:35:08 -0500 Received: from mail.uni-paderborn.de ([131.234.142.9]:48855) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YUEsi-0001D4-OV for qemu-devel@nongnu.org; Sat, 07 Mar 2015 08:35:04 -0500 Message-ID: <54FB0CEC.8090207@mail.uni-paderborn.de> Date: Sat, 07 Mar 2015 14:36:28 +0000 From: Bastian Koppelmann MIME-Version: 1.0 References: <1425720834-5811-1-git-send-email-sw@weilnetz.de> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] target-tricore: Fix two helper functions (clang warnings) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , Stefan Weil Cc: QEMU Developer On 03/07/2015 12:34 PM, Peter Maydell wrote: > On 7 March 2015 at 18:33, Stefan Weil wrote: >> 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)r1); > Also, surely some of these should be using r2, not r1? > At the moment we seem to use r1 for both dividend and > divisor, which does not look right at all... > > -- PMM Thats correct, it should be: abs_divisor = abs((int32_t)r2); My test suit did not get this, because I was only testing with a ISA version 1.3.1 cpu and this is 1.3 exclusive. Thanks for finding those. Cheers, Bastian