[7/8] sparc64: fix udiv and sdiv insns

Submitted by Igor V. Kovalenko on June 1, 2010, 8:12 p.m.

Details

Message ID 20100601201253.5908.41570.stgit@skyserv
State New
Headers show

Commit Message

Igor V. Kovalenko June 1, 2010, 8:12 p.m.
From: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>

- truncate second operand to 32bit

Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
---
 target-sparc/op_helper.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/target-sparc/op_helper.c b/target-sparc/op_helper.c
index 83067ae..4c5155f 100644
--- a/target-sparc/op_helper.c
+++ b/target-sparc/op_helper.c
@@ -3307,7 +3307,7 @@  target_ulong helper_udiv(target_ulong a, target_ulong b)
     uint32_t x1;
 
     x0 = (a & 0xffffffff) | ((int64_t) (env->y) << 32);
-    x1 = b;
+    x1 = (b & 0xffffffff);
 
     if (x1 == 0) {
         raise_exception(TT_DIV_ZERO);
@@ -3329,7 +3329,7 @@  target_ulong helper_sdiv(target_ulong a, target_ulong b)
     int32_t x1;
 
     x0 = (a & 0xffffffff) | ((int64_t) (env->y) << 32);
-    x1 = b;
+    x1 = (b & 0xffffffff);
 
     if (x1 == 0) {
         raise_exception(TT_DIV_ZERO);