mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-09 21:40:33 +02:00
VM: Add ASM_MUL for x86.
* libguile/vm-i-scheme.c (ASM_MUL): New macro. (mul): Use ASM_MUL if available.
This commit is contained in:
parent
9f6211707b
commit
4fa65b903b
1 changed files with 27 additions and 3 deletions
|
@ -287,6 +287,26 @@ VM_DEFINE_FUNCTION (149, ge, "ge?", 2)
|
|||
slow_sub: \
|
||||
do { } while (0)
|
||||
|
||||
# define ASM_MUL(x, y) \
|
||||
{ \
|
||||
scm_t_signed_bits xx = SCM_I_INUM (x); \
|
||||
asm volatile goto ("mov %1, %%"_CX"; " \
|
||||
"test %[tag], %%cl; je %l[slow_mul]; " \
|
||||
"sub %[tag], %%"_CX"; " \
|
||||
"test %[tag], %0; je %l[slow_mul]; " \
|
||||
"imul %2, %%"_CX"; jo %l[slow_mul]; " \
|
||||
"add %[tag], %%"_CX"; " \
|
||||
"mov %%"_CX", (%[vsp])\n" \
|
||||
: /* no outputs */ \
|
||||
: "r" (x), "r" (y), "r" (xx), \
|
||||
[vsp] "r" (sp), [tag] "i" (scm_tc2_int) \
|
||||
: _CX, "memory", "cc" \
|
||||
: slow_mul); \
|
||||
NEXT; \
|
||||
} \
|
||||
slow_mul: \
|
||||
do { } while (0)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -356,16 +376,20 @@ VM_DEFINE_FUNCTION (153, sub1, "sub1", 1)
|
|||
RETURN (scm_difference (x, SCM_I_MAKINUM (1)));
|
||||
}
|
||||
|
||||
# undef ASM_ADD
|
||||
# undef ASM_SUB
|
||||
|
||||
VM_DEFINE_FUNCTION (154, mul, "mul", 2)
|
||||
{
|
||||
ARGS2 (x, y);
|
||||
#ifdef ASM_MUL
|
||||
ASM_MUL (x, y);
|
||||
#endif
|
||||
SYNC_REGISTER ();
|
||||
RETURN (scm_product (x, y));
|
||||
}
|
||||
|
||||
# undef ASM_ADD
|
||||
# undef ASM_SUB
|
||||
# undef ASM_MUL
|
||||
|
||||
VM_DEFINE_FUNCTION (155, div, "div", 2)
|
||||
{
|
||||
ARGS2 (x, y);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue