JIT repair for `(/ (most-negative-fixnum) -1)'
When I added JIT-inling of '/' for fixnums, I somehow forgot to handle the special case that is already handled for `quotient'.
This commit is contained in:
parent
22dbcaa77f
commit
a0741c5ea7
|
@ -823,6 +823,8 @@
|
|||
(test (expt 2 29) / (- (expt 2 30)) -2)
|
||||
(test -1/1073741824 / (- (expt 2 30)))
|
||||
|
||||
(test (expt 2 30) / (- (expt 2 30)) -1)
|
||||
|
||||
(test +inf.0 / 1.0 0.0)
|
||||
(test -inf.0 / -1.0 0.0)
|
||||
(test +inf.0 / -1.0 -0.0)
|
||||
|
|
|
@ -499,6 +499,8 @@
|
|||
(bin -4/3 '/ 4 -3)
|
||||
(bin -4/3 '/ -4 3)
|
||||
(bin 4/3 '/ -4 -3)
|
||||
(bin (expt 2 30) '/ (- (expt 2 30)) -1)
|
||||
(bin (expt 2 62) '/ (- (expt 2 62)) -1)
|
||||
|
||||
(bin-int 3 'quotient 10 3)
|
||||
(bin-int -3 'quotient 10 -3)
|
||||
|
@ -508,6 +510,7 @@
|
|||
(bin-exact 3 'fxquotient 10 3)
|
||||
(bin-exact -3 'fxquotient 10 -3)
|
||||
(bin-exact (expt 2 30) 'quotient (- (expt 2 30)) -1)
|
||||
(bin-exact (expt 2 62) 'quotient (- (expt 2 62)) -1)
|
||||
|
||||
(bin-int 1 'remainder 10 3)
|
||||
(bin-int 1 'remainder 10 -3)
|
||||
|
|
|
@ -1616,13 +1616,19 @@ int scheme_generate_arith_for(mz_jit_state *jitter, Scheme_Object *rator, Scheme
|
|||
jit_modr_l(JIT_R0, JIT_V1, JIT_R2);
|
||||
|
||||
if (arith == ARITH_DIV) {
|
||||
GC_CAN_IGNORE jit_insn *refx;
|
||||
GC_CAN_IGNORE jit_insn *refx, *refz;
|
||||
__START_INNER_TINY__(branch_short);
|
||||
/* watch out for negation of most negative fixnum,
|
||||
which is a positive number too big for a fixnum */
|
||||
refz = jit_beqi_p(jit_forward(), JIT_R0, (void *)(((intptr_t)1 << ((8 * JIT_WORD_SIZE) - 2))));
|
||||
__END_INNER_TINY__(branch_short);
|
||||
if (reversed)
|
||||
jit_mulr_l(JIT_R2, JIT_R0, JIT_R2);
|
||||
else
|
||||
jit_mulr_l(JIT_V1, JIT_R0, JIT_V1);
|
||||
__START_INNER_TINY__(branch_short);
|
||||
refx = jit_beqr_l(jit_forward(), JIT_R2, JIT_V1);
|
||||
mz_patch_branch(refz);
|
||||
__END_INNER_TINY__(branch_short);
|
||||
/* restore R0 argument: */
|
||||
if (reversed) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user