1 (in-package "SB-ROTATE-BYTE")
6 (define-vop (%
32bit-rotate-byte
/c
)
8 (:translate %unsigned-32-rotate-byte
)
9 (:note
"inline 32-bit constant rotation")
10 (:args
(integer :scs
(sb-vm::unsigned-reg
) :target result
))
12 (:arg-types
(:constant
(integer -
31 31)) sb-vm
::unsigned-num
)
13 (:results
(result :scs
(sb-vm::unsigned-reg
)))
14 (:result-types sb-vm
::unsigned-num
)
16 (aver (not (= count
0)))
19 (inst rol
(sb-vm::reg-in-size result
:dword
) count
)
20 (inst ror
(sb-vm::reg-in-size result
:dword
) count
))))
22 (define-vop (%
32bit-rotate-byte
)
24 (:translate %unsigned-32-rotate-byte
)
25 (:args
(count :scs
(sb-vm::signed-reg
) :target rcx
)
26 (integer :scs
(sb-vm::unsigned-reg
) :target result
))
27 (:arg-types sb-vm
::tagged-num sb-vm
::unsigned-num
)
28 (:temporary
(:sc sb-vm
::signed-reg
:offset sb-vm
::rcx-offset
)
30 (:results
(result :scs
(sb-vm::unsigned-reg
) :from
:load
))
31 (:result-types sb-vm
::unsigned-num
)
33 (let ((label (gen-label))
37 (inst cmp
(sb-vm::reg-in-size rcx
:dword
) 0)
39 (inst neg
(sb-vm::reg-in-size rcx
:dword
))
40 (inst ror
(sb-vm::reg-in-size result
:dword
) :cl
)
43 (inst rol
(sb-vm::reg-in-size result
:dword
) :cl
)
48 (define-vop (%
64bit-rotate-byte
/c
)
50 (:translate %unsigned-64-rotate-byte
)
51 (:note
"inline 64-bit constant rotation")
52 (:args
(integer :scs
(sb-vm::unsigned-reg
) :target result
))
54 (:arg-types
(:constant
(integer -
63 63)) sb-vm
::unsigned-num
)
55 (:results
(result :scs
(sb-vm::unsigned-reg
)))
56 (:result-types sb-vm
::unsigned-num
)
58 (aver (not (= count
0)))
61 (inst rol result count
)
62 (inst ror result
(- count
)))))
64 (define-vop (%
64bit-rotate-byte
)
66 (:translate %unsigned-64-rotate-byte
)
67 (:args
(count :scs
(sb-vm::signed-reg
) :target rcx
)
68 (integer :scs
(sb-vm::unsigned-reg
) :target result
))
69 (:arg-types sb-vm
::tagged-num sb-vm
::unsigned-num
)
70 (:temporary
(:sc sb-vm
::signed-reg
:offset sb-vm
::rcx-offset
)
72 (:results
(result :scs
(sb-vm::unsigned-reg
) :from
:load
))
73 (:result-types sb-vm
::unsigned-num
)
75 (let ((label (gen-label))