wingo pushed a commit to branch lightning
in repository guile.
commit 7b2c9cfb2a4a97716de71d2f83bc95e63bf6053b
Author: pcpa <[email protected]>
Date: Tue Feb 5 14:06:41 2013 -0200
Correct qmul and qdiv in ppc.
* lib/jit_ppc-cpu.c, lib/jit_ppc.c: Validate and correct
problems in the qmul and qdiv ppc implementation.
---
ChangeLog | 5 +++++
lib/jit_ppc-cpu.c | 10 +++++-----
lib/jit_ppc.c | 2 +-
3 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index ee46e0b..85a6855 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-02-05 Paulo Andrade <[email protected]>
+
+ * lib/jit_ppc-cpu.c, lib/jit_ppc.c: Validate and correct
+ problems in the qmul and qdiv ppc implementation.
+
2013-02-04 Paulo Andrade <[email protected]>
* include/lightning.h, include/lightning/jit_private.h,
diff --git a/lib/jit_ppc-cpu.c b/lib/jit_ppc-cpu.c
index 56bf56a..f593d41 100644
--- a/lib/jit_ppc-cpu.c
+++ b/lib/jit_ppc-cpu.c
@@ -903,12 +903,12 @@ _iqmulr(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1,
else
MULLW(r0, r2, r3);
if (sign)
- MULLH(r1, r2, r3);
+ MULHW(r1, r2, r3);
else
- MULLHU(r1, r2, r3);
+ MULHWU(r1, r2, r3);
if (r0 == r2 || r0 == r3) {
movr(r0, rn(reg));
- reg = jit_unget_reg(reg);
+ jit_unget_reg(reg);
}
}
@@ -967,8 +967,8 @@ _iqdivr(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1,
divr(rg0, r2, r3);
else
divr_u(rg0, r2, r3);
- mulr(rg1, r2, r0);
- subr(rg1, r2, r0);
+ mulr(rg1, r3, rg0);
+ subr(rg1, r2, rg1);
if (rg0 != r0) {
movr(r0, rg0);
jit_unget_reg(sv0);
diff --git a/lib/jit_ppc.c b/lib/jit_ppc.c
index dafc36b..301c3fb 100644
--- a/lib/jit_ppc.c
+++ b/lib/jit_ppc.c
@@ -723,7 +723,7 @@ _emit_code(jit_state_t *_jit)
name##r##type(rn(node->u.w), \
rn(node->v.w), rn(node->w.w)); \
break
-#define case_rrr(name, type) \
+#define case_rrrr(name, type) \
case jit_code_##name##r##type: \
name##r##type(rn(node->u.q.l), rn(node->u.q.h), \
rn(node->v.w), rn(node->w.w)); \