1 ;;;; predicate VOPs for the x86 VM
3 ;;;; This software is part of the SBCL system. See the README file for
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.
16 ;;; The unconditional branch, emitted when we can't drop through to the desired
17 ;;; destination. Dest is the continuation we transfer control to.
24 ;;;; Generic conditional VOPs
26 ;;; The generic conditional branch, emitted immediately after test
27 ;;; VOPs that only set flags.
29 (define-vop (branch-if)
30 (:info dest flags not-p)
31 (:ignore dest flags not-p)
33 (error "BRANCH-IF not yet implemented")))
35 (!def-vm-support-routine
36 convert-conditional-move-p (node dst-tn x-tn y-tn)
37 (declare (ignore node dst-tn x-tn y-tn))
43 ;;; Note: a constant-tn is allowed in CMP; it uses an EA displacement,
44 ;;; not immediate data.
46 (:args (x :scs (any-reg descriptor-reg control-stack constant)
47 :load-if (not (and (sc-is x immediate)
48 (sc-is y any-reg descriptor-reg
49 control-stack constant))))
50 (y :scs (any-reg descriptor-reg immediate)
51 :load-if (not (and (sc-is x any-reg descriptor-reg immediate)
52 (sc-is y control-stack constant)))))
53 (:temporary (:sc descriptor-reg) temp)
61 (let ((val (tn-value y)))
64 (if (and (zerop val) (sc-is x any-reg descriptor-reg))
65 (inst test x x) ; smaller
66 (let ((fixnumized (fixnumize val)))
68 '(or (signed-byte 32) (unsigned-byte 31)))
69 (inst cmp x fixnumized)
71 (inst mov temp fixnumized)
72 (inst cmp x temp))))))
74 (inst cmp x (+ nil-value (static-symbol-offset val))))
76 (inst cmp x (logior (ash (char-code val) n-widetag-bits)
77 character-widetag))))))
78 ((sc-is x immediate) ; and y not immediate
79 ;; Swap the order to fit the compare instruction.
80 (let ((val (tn-value x)))
83 (if (and (zerop val) (sc-is y any-reg descriptor-reg))
84 (inst test y y) ; smaller
85 (let ((fixnumized (fixnumize val)))
87 '(or (signed-byte 32) (unsigned-byte 31)))
88 (inst cmp y fixnumized)
90 (inst mov temp fixnumized)
91 (inst cmp y temp))))))
93 (inst cmp y (+ nil-value (static-symbol-offset val))))
95 (inst cmp y (logior (ash (char-code val) n-widetag-bits)
96 character-widetag))))))
100 (inst jmp (if not-p :ne :e) target)))