summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2020-07-30 17:36:11 +0200
committerAndy Wingo <wingo@pobox.com>2020-07-30 17:36:11 +0200
commit172e5ccfc1e0a26880fd328ef72c7bbcb9c2fca1 (patch)
treea495dbbb5fdd3f58a9f3eef081a058daac91d14c /doc
parentf13b27a4cc6ea35e8595e7d926c5632eb797364a (diff)
downloadguile-172e5ccfc1e0a26880fd328ef72c7bbcb9c2fca1.tar.gz
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.
Diffstat (limited to 'doc')
-rw-r--r--doc/ref/vm.texi10
1 files changed, 8 insertions, 2 deletions
diff --git a/doc/ref/vm.texi b/doc/ref/vm.texi
index a94c60576..5064532e2 100644
--- a/doc/ref/vm.texi
+++ b/doc/ref/vm.texi
@@ -579,10 +579,12 @@ An unsigned @var{n}-bit integer, indicating a constant value.
@item l24
An offset from the current @code{ip}, in 32-bit units, as a signed
24-bit value. Indicates a bytecode address, for a relative jump.
-@item i16
+@item zi16
+@itemx i16
@itemx i32
An immediate Scheme value (@pxref{Immediate Objects}), encoded directly
-in 16 or 32 bits.
+in 16 or 32 bits. @code{zi16} is sign-extended; the others are
+zero-extended.
@item a32
@itemx b32
An immediate Scheme value, encoded as a pair of 32-bit words.
@@ -1358,6 +1360,10 @@ two kinds.
The first set of instructions loads immediate values. These
instructions encode the immediate directly into the instruction stream.
+@deftypefn Instruction {} make-immediate s8:@var{dst} zi16:@var{low-bits}
+Make an immediate whose low bits are @var{low-bits}, sign-extended.
+@end deftypefn
+
@deftypefn Instruction {} make-short-immediate s8:@var{dst} i16:@var{low-bits}
Make an immediate whose low bits are @var{low-bits}, and whose top bits are
0.