1 (in-package "SB-ROTATE-BYTE")
5 (define-vop (%
32bit-rotate-byte
/c
)
7 (:translate %unsigned-32-rotate-byte
)
8 (:note
"inline 32-bit constant rotation")
9 (:args
(integer :scs
(sb-vm::unsigned-reg
) :target result
))
11 (:arg-types
(:constant
(integer -
31 31)) sb-vm
::unsigned-num
)
12 (:results
(result :scs
(sb-vm::unsigned-reg
)))
13 (:result-types sb-vm
::unsigned-num
)
15 (aver (not (= count
0)))
16 (inst ror
(sb-vm::32-bit-reg result
) (sb-vm::32-bit-reg integer
)
21 (define-vop (%
32bit-rotate-byte
)
23 (:translate %unsigned-32-rotate-byte
)
24 (:note
"inline 32-bit rotation")
25 (:args
(count :scs
(sb-vm::signed-reg
))
26 (integer :scs
(sb-vm::unsigned-reg
)))
27 (:arg-types sb-vm
::tagged-num sb-vm
::unsigned-num
)
28 (:results
(res :scs
(sb-vm::unsigned-reg
)))
29 (:result-types sb-vm
::unsigned-num
)
31 (inst neg sb-vm
::tmp-tn count
)
32 (inst ror
(sb-vm::32-bit-reg res
)
33 (sb-vm::32-bit-reg integer
) (sb-vm::32-bit-reg sb-vm
::tmp-tn
))))
36 (define-vop (%
64bit-rotate-byte
/c
)
38 (:translate %unsigned-64-rotate-byte
)
39 (:note
"inline 64-bit constant rotation")
40 (:args
(integer :scs
(sb-vm::unsigned-reg
) :target result
))
42 (:arg-types
(:constant
(integer -
63 63)) sb-vm
::unsigned-num
)
43 (:results
(result :scs
(sb-vm::unsigned-reg
)))
44 (:result-types sb-vm
::unsigned-num
)
46 (aver (not (= count
0)))
47 (inst ror result integer
(if (plusp count
)
51 (define-vop (%
64bit-rotate-byte
)
53 (:translate %unsigned-64-rotate-byte
)
54 (:note
"inline 64-bit rotation")
55 (:args
(count :scs
(sb-vm::signed-reg
))
56 (integer :scs
(sb-vm::unsigned-reg
)))
57 (:arg-types sb-vm
::tagged-num sb-vm
::unsigned-num
)
58 (:results
(res :scs
(sb-vm::unsigned-reg
)))
59 (:result-types sb-vm
::unsigned-num
)
61 (inst neg sb-vm
::tmp-tn count
)
62 (inst ror res integer sb-vm
::tmp-tn
)))