(aver (not (= count 0)))
(move res integer)
(if (> count 0)
- (inst rol res count)
- (inst ror res (- count)))))
+ (inst rol res count)
+ (inst ror res (- count)))))
(define-vop (%32bit-rotate-byte-fixnum/c)
(:policy :fast-safe)
(t (inst ror res (- 2 count))))))
(macrolet ((def (name arg-type)
- `(define-vop (,name)
- (:policy :fast-safe)
- (:translate %unsigned-32-rotate-byte)
- (:note "inline 32-bit rotation")
- (:args (count :scs (sb-vm::signed-reg) :target ecx)
- (integer :scs (sb-vm::unsigned-reg) :target res))
- (:arg-types sb-vm::tagged-num ,arg-type)
- (:temporary (:sc sb-vm::signed-reg :offset sb-vm::ecx-offset)
- ecx)
- (:results (res :scs (sb-vm::unsigned-reg)))
- (:result-types sb-vm::unsigned-byte-32)
- (:generator 10
- (let ((label (gen-label))
- (end (gen-label)))
- (move res integer)
- (move ecx count)
- (inst cmp ecx 0)
- (inst jmp :ge label)
- (inst neg ecx)
- (inst ror res :cl)
- (inst jmp end)
- (emit-label label)
- (inst rol res :cl)
- (emit-label end))))))
+ `(define-vop (,name)
+ (:policy :fast-safe)
+ (:translate %unsigned-32-rotate-byte)
+ (:note "inline 32-bit rotation")
+ (:args (count :scs (sb-vm::signed-reg) :target ecx)
+ (integer :scs (sb-vm::unsigned-reg) :target res))
+ (:arg-types sb-vm::tagged-num ,arg-type)
+ (:temporary (:sc sb-vm::signed-reg :offset sb-vm::ecx-offset)
+ ecx)
+ (:results (res :scs (sb-vm::unsigned-reg) :from :load))
+ (:result-types sb-vm::unsigned-byte-32)
+ (:generator 10
+ (let ((label (gen-label))
+ (end (gen-label)))
+ (move res integer)
+ (move ecx count)
+ (inst cmp ecx 0)
+ (inst jmp :ge label)
+ (inst neg ecx)
+ (inst ror res :cl)
+ (inst jmp end)
+ (emit-label label)
+ (inst rol res :cl)
+ (emit-label end))))))
(def %32bit-rotate-byte sb-vm::unsigned-byte-32)
;; FIXME: it's not entirely clear to me why we need this second
;; definition -- or rather, why the compiler isn't smart enough to