coreparse: do some things on empty spaces anyway.
[sbcl.git] / contrib / sb-rotate-byte / arm64-vm.lisp
blob3fd7d8704f14be526024ac3afbac5a3b2bef16b6
1 (in-package "SB-ROTATE-BYTE")
3 ;;; 32-bit
5 (define-vop (%32bit-rotate-byte/c)
6 (:policy :fast-safe)
7 (:translate %unsigned-32-rotate-byte)
8 (:note "inline 32-bit constant rotation")
9 (:args (integer :scs (sb-vm::unsigned-reg) :target result))
10 (:info count)
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)
14 (:generator 5
15 (aver (not (= count 0)))
16 (inst ror (sb-vm::32-bit-reg result) (sb-vm::32-bit-reg integer)
17 (if (plusp count)
18 (- 32 count)
19 (abs count)))))
21 (define-vop (%32bit-rotate-byte)
22 (:policy :fast-safe)
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)
30 (:generator 10
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))))
35 ;;; 64-bit
36 (define-vop (%64bit-rotate-byte/c)
37 (:policy :fast-safe)
38 (:translate %unsigned-64-rotate-byte)
39 (:note "inline 64-bit constant rotation")
40 (:args (integer :scs (sb-vm::unsigned-reg) :target result))
41 (:info count)
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)
45 (:generator 5
46 (aver (not (= count 0)))
47 (inst ror result integer (if (plusp count)
48 (- 64 count)
49 (abs count)))))
51 (define-vop (%64bit-rotate-byte)
52 (:policy :fast-safe)
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)
60 (:generator 10
61 (inst neg sb-vm::tmp-tn count)
62 (inst ror res integer sb-vm::tmp-tn)))