Patchwork [4/5] target-alpha: Fix cvtlq.

login
register
mail settings
Submitter Richard Henderson
Date Dec. 14, 2009, 1:48 a.m.
Message ID <5428d17fff3b0886e17451fba1edb884b1a23f03.1260755765.git.rth@twiddle.net>
Download mbox | patch
Permalink /patch/41059/
State New
Headers show

Comments

Richard Henderson - Dec. 14, 2009, 1:48 a.m.
We were missing the 0xc0000000 mask, leading to incorrect results.

Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 target-alpha/op_helper.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Patch

diff --git a/target-alpha/op_helper.c b/target-alpha/op_helper.c
index 8eba5ec..ff120ad 100644
--- a/target-alpha/op_helper.c
+++ b/target-alpha/op_helper.c
@@ -954,7 +954,9 @@  uint64_t helper_cvtqg (uint64_t a)
 
 uint64_t helper_cvtlq (uint64_t a)
 {
-    return (int64_t)((int32_t)((a >> 32) | ((a >> 29) & 0x3FFFFFFF)));
+    int32_t lo = a >> 29;
+    int32_t hi = a >> 32;
+    return (lo & 0x3FFFFFFF) | (hi & 0xc0000000);
 }
 
 static inline uint64_t __helper_cvtql(uint64_t a, int s, int v)