mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-24 12:20:20 +02:00
Add sign-extending make-immediate instruction
* doc/ref/vm.texi (Instruction Set, Constant Instructions): Document new instruction. * libguile/instructions.c (FOR_EACH_INSTRUCTION_WORD_TYPE): New first word kind with zi16 operand. * libguile/jit.c (compile_make_immediate, compile_make_immediate_slow): New compilers. (COMPILE_X8_S8_ZI16): New operand kind. * libguile/vm-engine.c (make-immediate): New instruction. * module/language/bytecode.scm: * module/system/vm/assembler.scm (encode-X8_S8_ZI16<-/shuffle): (signed-bits, load-constant): Support the new instruction kind. * module/system/vm/disassembler.scm (disassemblers) (sign-extended-immediate, code-annotation): Support for zi16 operands.
This commit is contained in:
parent
f13b27a4cc
commit
172e5ccfc1
7 changed files with 88 additions and 5 deletions
|
@ -44,6 +44,7 @@ SCM_SYMBOL (sym_bang, "!");
|
|||
M(X8_L24) \
|
||||
M(X8_C24) \
|
||||
M(X8_S8_I16) \
|
||||
M(X8_S8_ZI16) \
|
||||
M(X8_S12_S12) \
|
||||
M(X8_S12_C12) \
|
||||
M(X8_S12_Z12) \
|
||||
|
|
|
@ -2816,6 +2816,17 @@ compile_call_u64_from_scm_slow (scm_jit_state *j, uint16_t dst, uint16_t a, uint
|
|||
{
|
||||
}
|
||||
|
||||
static void
|
||||
compile_make_immediate (scm_jit_state *j, uint8_t dst, SCM a)
|
||||
{
|
||||
emit_movi (j, T0, SCM_UNPACK (a));
|
||||
emit_sp_set_scm (j, dst, T0);
|
||||
}
|
||||
static void
|
||||
compile_make_immediate_slow (scm_jit_state *j, uint8_t dst, SCM a)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
compile_make_short_immediate (scm_jit_state *j, uint8_t dst, SCM a)
|
||||
{
|
||||
|
@ -5274,6 +5285,14 @@ compile_s64_to_f64_slow (scm_jit_state *j, uint16_t dst, uint16_t src)
|
|||
comp (j, a, SCM_PACK (b)); \
|
||||
}
|
||||
|
||||
#define COMPILE_X8_S8_ZI16(j, comp) \
|
||||
{ \
|
||||
uint8_t a; \
|
||||
int16_t b; \
|
||||
UNPACK_8_16 (j->ip[0], a, b); \
|
||||
comp (j, a, SCM_PACK ((scm_t_signed_bits) b)); \
|
||||
}
|
||||
|
||||
#define COMPILE_X32__C32(j, comp) \
|
||||
{ \
|
||||
comp (j, j->ip[1]); \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright 2001,2009-2015,2017-2019
|
||||
/* Copyright 2001,2009-2015,2017-2020
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Guile.
|
||||
|
@ -3401,7 +3401,21 @@ VM_NAME (scm_thread *thread)
|
|||
NEXT (offset);
|
||||
}
|
||||
|
||||
VM_DEFINE_OP (164, unused_164, NULL, NOP)
|
||||
/* make-immediate dst:8 low-bits:16
|
||||
*
|
||||
* Make an immediate whose low bits are LOW-BITS, and whose top bits
|
||||
* are sign-extended.
|
||||
*/
|
||||
VM_DEFINE_OP (164, make_immediate, "make-immediate", DOP1 (X8_S8_ZI16))
|
||||
{
|
||||
uint8_t dst;
|
||||
int16_t val;
|
||||
|
||||
UNPACK_8_16 (op, dst, val);
|
||||
SP_SET (dst, SCM_PACK ((scm_t_signed_bits) val));
|
||||
NEXT (1);
|
||||
}
|
||||
|
||||
VM_DEFINE_OP (165, unused_165, NULL, NOP)
|
||||
VM_DEFINE_OP (166, unused_166, NULL, NOP)
|
||||
VM_DEFINE_OP (167, unused_167, NULL, NOP)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue