[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] target-tricore: Fix two helper functions (clang

From: Bastian Koppelmann
Subject: Re: [Qemu-devel] [PATCH] target-tricore: Fix two helper functions (clang warnings)
Date: Sat, 07 Mar 2015 14:36:28 +0000
User-agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.5.0

On 03/07/2015 12:34 PM, Peter Maydell wrote:
On 7 March 2015 at 18:33, Stefan Weil <address@hidden> 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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]