source: release/1.11/source/level-0/X86/X8632/x8632-pred.lisp

Last change on this file was 16688, checked in by R. Matthew Emerson, 9 years ago

Merge copyright/license header changes to 1.11 release branch.

File size: 3.0 KB
RevLine 
[16688]1;;;
[13067]2;;; Copyright 2009 Clozure Associates
3;;;
[16688]4;;; Licensed under the Apache License, Version 2.0 (the "License");
5;;; you may not use this file except in compliance with the License.
6;;; You may obtain a copy of the License at
[13067]7;;;
[16688]8;;; http://www.apache.org/licenses/LICENSE-2.0
[13067]9;;;
[16688]10;;; Unless required by applicable law or agreed to in writing, software
11;;; distributed under the License is distributed on an "AS IS" BASIS,
12;;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13;;; See the License for the specific language governing permissions and
14;;; limitations under the License.
[13067]15
[7999]16(in-package "CCL")
17
18(eval-when (:compile-toplevel :execute)
19 (require "X86-LAPMACROS"))
20
21(defx8632lapfunction eql ((x arg_y) (y arg_z))
22 "Return T if OBJ1 and OBJ2 represent either the same object or
23numbers with the same type and value."
24 (check-nargs 2)
[15301]25 (jmp-subprim .SPbuiltin-eql))
[7999]26
27(defx8632lapfunction equal ((x arg_y) (y arg_z))
28 "Return T if X and Y are EQL or if they are structured components
29 whose elements are EQUAL. Strings and bit-vectors are EQUAL if they
30 are the same length and have identical components. Other arrays must be
31 EQ to be EQUAL. Pathnames are EQUAL if their components are."
32 (check-nargs 2)
33 @top
34 @tail
35 (cmp (% x) (% y))
36 (je @win)
[8905]37 (movl (% x) (% imm0))
38 (andb ($ x8632::fulltagmask) (% al))
39 (movb (% arg_z.b) (% ah))
40 (andb ($ x8632::fulltagmask) (% ah))
[7999]41 (cmpb (% al) (% ah))
[8905]42 (jnz @lose)
[7999]43 (cmpb ($ x8632::fulltag-cons) (% imm0.b))
44 (je @cons)
45 (cmpb ($ x8632::fulltag-misc) (% imm0.b))
46 (je @misc)
47 @lose
[10959]48 (movl ($ (target-nil-value)) (% arg_z))
[7999]49 (single-value-return)
50 @win
[10959]51 (movl ($ (target-t-value)) (% arg_z))
[7999]52 (single-value-return)
53 @cons
[11353]54 ;; If either X or Y is NIL, lose.
55 (cmp-reg-to-nil x)
56 (je @lose)
57 (cmp-reg-to-nil y)
58 (je @lose)
[7999]59 ;; Check to see if the CARs are EQ. If so, we can avoid saving
60 ;; context, and can just tail call ourselves on the CDRs.
61 (%car x temp0)
62 (%car y temp1)
63 (cmpl (% temp0) (% temp1))
64 (jne @recurse)
65 (%cdr x x)
66 (%cdr y y)
67 (jmp @tail)
68 @recurse
69 (save-simple-frame)
70 (pushl (@ x8632::cons.cdr (% x)))
71 (pushl (@ x8632::cons.cdr (% y)))
72 (movl (% temp0) (% x))
73 (movl (% temp1) (% y))
74 (:talign 5)
75 (call @top)
76 (recover-fn)
77 (cmp-reg-to-nil arg_z)
78 (pop (% y))
79 (pop (% x))
80 (restore-simple-frame)
81 (jnz @top)
[10959]82 (movl ($ (target-nil-value)) (% arg_z))
[7999]83 (single-value-return)
84 @misc
85 ;; Both objects are uvectors of some sort. Try EQL; if that fails,
86 ;; call HAIRY-EQUAL.
87 (save-simple-frame)
88 (pushl (% x))
89 (pushl (% y))
90 (call-symbol eql 2)
91 (cmp-reg-to-nil arg_z)
92 (jne @won-with-eql)
93 (popl (% y))
94 (popl (% x))
95 (restore-simple-frame)
96 (jump-symbol hairy-equal 2)
97 @won-with-eql
98 (restore-simple-frame) ; discards pushed args
[10959]99 (movl ($ (target-t-value)) (% arg_z))
[7999]100 (single-value-return))
101
102(defx8632lapfunction %lisp-lowbyte-ref ((thing arg_z))
103 (box-fixnum thing arg_z)
104 (andl ($ '#xff) (%l arg_z))
105 (single-value-return))
Note: See TracBrowser for help on using the repository browser.