From 0e83b52d49086de1f74ca3906136aa4475b0d520 Mon Sep 17 00:00:00 2001 From: pcpa Date: Fri, 14 Dec 2012 17:39:29 -0200 Subject: [PATCH] Correct test cases to work with x87 in ix86. * lib/jit_x86-x87.c, lib/jit_x86.c: Correct test cases in ix86 when using the x87 coprocessor instead of sse2+. --- ChangeLog | 5 +++++ lib/jit_x86-x87.c | 8 ++++---- lib/jit_x86.c | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index b0802dd3d..9d7c4e1d1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-12-14 Paulo Andrade + + * lib/jit_x86-x87.c, lib/jit_x86.c: Correct test cases in ix86 + when using the x87 coprocessor instead of sse2+. + 2012-12-14 Paulo Andrade * include/lightning.h, include/lightning/jit_private.h, diff --git a/lib/jit_x86-x87.c b/lib/jit_x86-x87.c index 5ad905d5b..579c66136 100644 --- a/lib/jit_x86-x87.c +++ b/lib/jit_x86-x87.c @@ -442,7 +442,7 @@ _x87_addr_d(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1, jit_int32_t r2) faddr(_ST0_REGNO, r2); else { fxchr(r0); - faddr(_ST0_REGNO, r2); + faddr(_ST0_REGNO, r0 == r2 ? _ST0_REGNO : r2); fxchr(r0); } } @@ -476,7 +476,7 @@ _x87_subr_d(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1, jit_int32_t r2) fsubr(_ST0_REGNO, r2); else { fxchr(r0); - fsubr(_ST0_REGNO, r0); + fsubr(_ST0_REGNO, r0 == r2 ? _ST0_REGNO : r2); fxchr(r0); } } @@ -510,7 +510,7 @@ _x87_mulr_d(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1, jit_int32_t r2) fmulr(_ST0_REGNO, r2); else { fxchr(r0); - fmulr(_ST0_REGNO, r2); + fmulr(_ST0_REGNO, r0 == r2 ? _ST0_REGNO : r2); fxchr(r0); } } @@ -544,7 +544,7 @@ _x87_divr_d(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1, jit_int32_t r2) fdivr(_ST0_REGNO, r2); else { fxchr(r0); - fdivr(_ST0_REGNO, r0); + fdivr(_ST0_REGNO, r0 == r2 ? _ST0_REGNO : r2); fxchr(r0); } } diff --git a/lib/jit_x86.c b/lib/jit_x86.c index 8386a851e..4bbc5e930 100644 --- a/lib/jit_x86.c +++ b/lib/jit_x86.c @@ -953,7 +953,7 @@ _jit_emit(jit_state_t *_jit) break #define case_rrf(name, type) \ case jit_code_##name##r##type: \ - if (jit_x87_reg_p(node->u.w)) \ + if (jit_x87_reg_p(node->w.w)) \ x87_##name##r##type(rn(node->u.w), \ rn(node->v.w), rn(node->w.w)); \ else \