Tweaks to get sb-simd 1.3 to compile
[sbcl/simd.git] / src / compiler / sparc / subprim.lisp
blob733ad6a67c73b2b16326566265e04452d382f6bc
1 ;;;; linkage information for standard static functions, and random vops
3 ;;;; This software is part of the SBCL system. See the README file for
4 ;;;; more information.
5 ;;;;
6 ;;;; This software is derived from the CMU CL system, which was
7 ;;;; written at Carnegie Mellon University and released into the
8 ;;;; public domain. The software is in the public domain and is
9 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
10 ;;;; files for more information.
12 (in-package "SB!VM")
14 ;;;; LENGTH
15 (define-vop (length/list)
16 (:translate length)
17 (:args (object :scs (descriptor-reg) :target ptr))
18 (:arg-types list)
19 (:temporary (:scs (descriptor-reg) :from (:argument 0)) ptr)
20 (:temporary (:scs (non-descriptor-reg)) temp)
21 (:temporary (:scs (any-reg) :type fixnum :to (:result 0) :target result)
22 count)
23 (:results (result :scs (any-reg descriptor-reg)))
24 (:policy :fast-safe)
25 (:vop-var vop)
26 (:save-p :compute-only)
27 (:generator 50
28 (let ((done (gen-label))
29 (loop (gen-label))
30 (not-list (generate-cerror-code vop object-not-list-error object)))
31 (move ptr object)
32 (move count zero-tn)
34 (emit-label loop)
36 (inst cmp ptr null-tn)
37 (inst b :eq done)
38 (inst nop)
40 ;; FIXME: Maybe rewrite this to remove this TEST-TYPE (and the
41 ;; one below) to put it in line with all other architectures
42 ;; (apart from PPC)?
43 (test-type ptr not-list t (list-pointer-lowtag) :temp temp)
45 (loadw ptr ptr cons-cdr-slot list-pointer-lowtag)
46 (inst add count count (fixnumize 1))
47 (test-type ptr loop nil (list-pointer-lowtag) :temp temp)
49 (cerror-call vop done object-not-list-error ptr)
51 (emit-label done)
52 (move result count))))
55 (define-static-fun length (object) :translate length)