From 38a0f6d89a39999a629c85240d75b7baa739eefa Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Thu, 11 Feb 2010 04:00:18 +0000 Subject: [PATCH] fix the actual result value for unboxed flmin and flmax svn: r18045 --- collects/tests/mzscheme/optimize.ss | 4 ++++ src/mzscheme/src/jit.c | 14 ++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/collects/tests/mzscheme/optimize.ss b/collects/tests/mzscheme/optimize.ss index aceb92d3ba..39a0eabaaa 100644 --- a/collects/tests/mzscheme/optimize.ss +++ b/collects/tests/mzscheme/optimize.ss @@ -420,6 +420,8 @@ (tri 5 'min (lambda () 20) 10 5 void) (bin-exact 3.0 'flmin 3.0 4.5) (bin-exact 2.5 'flmin 3.0 2.5) + (bin0 3.5 '(lambda (x y) (fl+ 1.0 (flmin x y))) 3.0 2.5) + (bin0 4.0 '(lambda (x y) (fl+ 1.0 (flmin x y))) 3.0 4.5) (bin-exact 30 'fxmin 30 45) (bin-exact 25 'fxmin 30 25) @@ -431,6 +433,8 @@ (tri 50 'max (lambda () 20) 10 50 void) (bin-exact 4.5 'flmax 3.0 4.5) (bin-exact 3.0 'flmax 3.0 2.5) + (bin0 5.5 '(lambda (x y) (fl+ 1.0 (flmax x y))) 3.0 4.5) + (bin0 4.0 '(lambda (x y) (fl+ 1.0 (flmax x y))) 3.0 2.5) (bin-exact 45 'fxmax 30 45) (bin-exact 30 'fxmax 30 25) diff --git a/src/mzscheme/src/jit.c b/src/mzscheme/src/jit.c index bb2f4f0234..f6c17b8e2a 100644 --- a/src/mzscheme/src/jit.c +++ b/src/mzscheme/src/jit.c @@ -4709,13 +4709,19 @@ static int generate_double_arith(mz_jit_state *jitter, Scheme_Object *rator, mz_rs_sync(); /* needed if arguments were unboxed */ generate_alloc_double(jitter, 0); CHECK_LIMIT(); + #if defined(MZ_USE_JIT_I386) + if (need_post_pop) + FSTPr(0); +#endif } else if (unboxed_result) { jitter->unbox_depth++; - } -#if defined(MZ_USE_JIT_I386) - if (need_post_pop) - FSTPr(0); + #if defined(MZ_USE_JIT_I386) + if (need_post_pop) { + FXCHr(1); + FSTPr(0); + } #endif + } } else { /* The "anti" variants below invert the branch. Unlike the "un" variants, the "anti" variants invert the comparison result