On this page:
shri
shli
sari
roti
shrr
shlr
sarr
rotr
shrpi
shlpi
sarpi
rotpi
shrpr
shlpr
sarpr
rotpr
shr
shl
sar
rot

6 0111 - Shifter🔗

opcode

(shri a i)

 
a = bb68-gpr
 
  a : (integer-in 0 15)
  i : (integer-in 0 15)

image

 mask: ff00

value: 7000

This is a more general version of bsl which allows shifting register n to the left by i.

It uses bitwise/logical shift which shifts-in zeroes from the left.

opcode

(shli a i)

 
a = bb68-gpr
 
  a : (integer-in 0 15)
  i : (integer-in 0 15)

image

 mask: ff00

value: 7100

A more general version of bsr which shifts register n to the right by i.

opcode

(sari a i)

 
a = bb68-gpr
 
  a : (integer-in 0 15)
  i : (integer-in 0 15)

image

 mask: ff00

value: 7200

A generic version of sbsr which shifts register n to the right by i keeping the most significant (sign) bit intact.

opcode

(roti a i)

 
a = bb68-gpr
 
  a : (integer-in 0 15)
  i : (integer-in 0 15)

image

 mask: ff00

value: 7300

Rotates register n to the left by i.

Rotation to the right can be achieved by rotating by 16-1i to the left using this instruction.

opcode

(shrr a s)

 
a = bb68-gpr
     
s = bb68-gpr
 
  a : (integer-in 0 15)
  s : (integer-in 0 15)

image

 mask: ff00

value: 7400

Like shri but it is shifted by the value in register m. If m is greater than 15, the result is always 0.

opcode

(shlr a s)

 
a = bb68-gpr
     
s = bb68-gpr
 
  a : (integer-in 0 15)
  s : (integer-in 0 15)

image

 mask: ff00

value: 7500

Like shli but it is shifted by the value in register m. If m is greater than 15, the result is always 0.

opcode

(sarr a s)

 
a = bb68-gpr
     
s = bb68-gpr
 
  a : (integer-in 0 15)
  s : (integer-in 0 15)

image

 mask: ff00

value: 7600

Like shri but it is shifted by the value in register m. If m is greater than 15, the result is always 0 for nonnegative values of m and -1 for its negative values.

opcode

(rotr a s)

 
a = bb68-gpr
     
s = bb68-gpr
 
  a : (integer-in 0 15)
  s : (integer-in 0 15)

image

 mask: ff00

value: 7700

Rotates register n to the left by the value in register m modulo 16.

opcode

(shrpi A i)

 
A = bb68-gprp
 
  A : (integer-in 0 7)
  i : (integer-in 0 31)

image

 mask: ff00

value: 7800

Shifts a pair of registers N to the right by i. This is a bitwise/logical shift which shifts-in zeroes from the left.

opcode

(shlpi A i)

 
A = bb68-gprp
 
  A : (integer-in 0 7)
  i : (integer-in 0 31)

image

 mask: ff00

value: 7900

Shifts a pair of registers N to the left by i.

opcode

(sarpi A i)

 
A = bb68-gprp
 
  A : (integer-in 0 7)
  i : (integer-in 0 31)

image

 mask: ff00

value: 7a00

Shifts a pair of registers N to the right by i. As an arithmetic shift it keeps the most significant bit (sign) intact.

opcode

(rotpi A i)

 
A = bb68-gprp
 
  A : (integer-in 0 7)
  i : (integer-in 0 31)

image

 mask: ff00

value: 7b00

Rotates register pair N to the left by i.

Rotation to the right can be achieved by rotating by 32-1i to the left using this instruction.

opcode

(shrpr A t)

 
A = bb68-gprp
     
t = bb68-gpr
 
  A : (integer-in 0 7)
  t : (integer-in 0 15)

image

 mask: ff10

value: 7c00

Shifts a pair of registers N to the right by i. This is a bitwise/logical shift which shifts-in zeroes from the left.

opcode

(shlpr A t)

 
A = bb68-gprp
     
t = bb68-gpr
 
  A : (integer-in 0 7)
  t : (integer-in 0 15)

image

 mask: ff10

value: 7d00

Shifts a pair of registers N to the left by i.

opcode

(sarpr A t)

 
A = bb68-gprp
     
t = bb68-gpr
 
  A : (integer-in 0 7)
  t : (integer-in 0 15)

image

 mask: ff10

value: 7e00

Shifts a pair of registers N to the right by i. As an arithmetic shift it keeps the most significant bit (sign) intact.

opcode

(rotpr A t)

 
A = bb68-gprp
     
t = bb68-gpr
 
  A : (integer-in 0 7)
  t : (integer-in 0 15)

image

 mask: ff10

value: 7f00

Rotates register pair N to the left by i.

Rotation to the right can be achieved by rotating by 32-1i to the left using this instruction.

macro opcode

(shr variant)

 
variant = r:bb68-gpr i:bb68-word
  | r:bb68-gpr q:bb68-gpr
  | p:bb68-gprp i:bb68-word
  | p:bb68-gprp q:bb68-gpr
Shifts to the right either the register r by immediate value i, or the register r by the value in register q, or the register pair p by the immediate value i.

macro opcode

(shl variant)

 
variant = r:bb68-gpr i:bb68-word
  | r:bb68-gpr q:bb68-gpr
  | p:bb68-gprp i:bb68-word
  | p:bb68-gprp q:bb68-gpr
Shifts to the left either the register r by immediate value i, or the register r by the value in register q, or the register pair p by the immediate value i.

macro opcode

(sar variant)

 
variant = r:bb68-gpr i:bb68-word
  | r:bb68-gpr q:bb68-gpr
  | p:bb68-gprp i:bb68-word
  | p:bb68-gprp q:bb68-gpr
Shifts to the right either the register r by immediate value i, or the register r by the value in register q, or the register pair p by the immediate value i.

If the shift amount is greater than 15 for registers and 31 for pairs, the result is always 0 for nonnegative values of m and -1 for its negative values.

macro opcode

(rot variant)

 
variant = r:bb68-gpr i:bb68-word
  | r:bb68-gpr q:bb68-gpr
  | p:bb68-gprp i:bb68-word
  | p:bb68-gprp q:bb68-gpr
Rotate macro.