Warning: This is the manual of the legacy Guile 2.2 series. You may want to read the manual of the current stable series instead.

Next: , Previous: , Up: Instruction Set   [Contents][Index]


9.3.7.14 Unboxed Integer Arithmetic

Guile supports two kinds of unboxed integers: unsigned 64-bit integers, and signed 64-bit integers. Guile prefers unsigned integers, in the sense that Guile’s compiler supports them better and the virtual machine has more operations that work on them. Still, signed integers are supported at least to allow bv-s64-ref and related instructions to avoid boxing their values.

Instruction: scm->u64 s12:dst s12:src

Unbox the SCM value at src to a unsigned 64-bit integer, placing the result in dst. If the src value is not an exact integer in the unsigned 64-bit range, signal an error.

Instruction: u64->scm s12:dst s12:src

Box the unsigned 64-bit integer at src to a SCM value and place the result in dst. The result will be a fixnum or a bignum.

Instruction: load-u64 s24:dst au32:high-bits au32:low-bits

Load a 64-bit value formed by joining high-bits and low-bits, and write it to dst.

Instruction: scm->s64 s12:dst s12:src
Instruction: s64->scm s12:dst s12:src
Instruction: load-s64 s24:dst as32:high-bits as32:low-bits

Like scm->u64, u64->scm, and load-u64, but for signed 64-bit integers.

Sometimes the compiler can know that we will only need a subset of the bits in an integer. In that case we can sometimes unbox an integer even if it might be out of range.

Instruction: scm->u64/truncate s12:dst s12:src

Take the SCM value in dst and logand it with (1- (ash 1 64)). Place the unboxed result in dst.

Instruction: br-if-u64-= s24:a x8:_ s24:b b1:invert x7:_ l24:offset
Instruction: br-if-u64-< s24:a x8:_ s24:b b1:invert x7:_ l24:offset
Instruction: br-if-u64-<= s24:a x8:_ s24:b b1:invert x7:_ l24:offset

If the unboxed unsigned 64-bit integer value in a is =, <, or <= to the unboxed unsigned 64-bit integer value in b, respectively, add offset to the current instruction pointer.

Instruction: br-if-u64-=-scm s24:a x8:_ s24:b b1:invert x7:_ l24:offset
Instruction: br-if-u64-<-scm s24:a x8:_ s24:b b1:invert x7:_ l24:offset
Instruction: br-if-u64-<=-scm s24:a x8:_ s24:b b1:invert x7:_ l24:offset

If the unboxed unsigned 64-bit integer value in a is =, <, or <= to the SCM value in b, respectively, add offset to the current instruction pointer.

Instruction: uadd s8:dst s8:a s8:b
Instruction: usub s8:dst s8:a s8:b
Instruction: umul s8:dst s8:a s8:b

Like add, sub, and mul, except taking the operands as unboxed unsigned 64-bit integers, and producing the same. The result will be silently truncated to 64 bits.

Instruction: uadd/immediate s8:dst s8:a c8:b
Instruction: usub/immediate s8:dst s8:a c8:b
Instruction: umul/immediate s8:dst s8:a c8:b

Like uadd, usub, and umul, except the second operand is an immediate unsigned 8-bit integer.

Instruction: ulogand s8:dst s8:a s8:b
Instruction: ulogior s8:dst s8:a s8:b
Instruction: ulogxor s8:dst s8:a s8:b
Instruction: ulogsub s8:dst s8:a s8:b

Like logand, logior, logxor, and logsub, but operating on unboxed unsigned 64-bit integers.

Instruction: ulsh s8:dst s8:a s8:b

Shift the unboxed unsigned 64-bit integer in a left by b bits, also an unboxed unsigned 64-bit integer. Truncate to 64 bits and write to dst as an unboxed value. Only the lower 6 bits of b are used.

Instruction: ursh s8:dst s8:a s8:b

Like ulsh, but shifting right.

Instruction: ulsh/immediate s8:dst s8:a c8:b
Instruction: ursh/immediate s8:dst s8:a c8:b

Like ulsh and ursh, but encoding b as an immediate 8-bit unsigned integer.


Next: , Previous: , Up: Instruction Set   [Contents][Index]