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)))))
58 (let ((x-val (encode-value-if-immediate x))
59 (y-val (encode-value-if-immediate y)))
61 ;; Shorter instruction sequences for these two cases.
62 ((and (eql 0 y-val) (sc-is x any-reg descriptor-reg)) (inst test x x))
63 ((and (eql 0 x-val) (sc-is y any-reg descriptor-reg)) (inst test y y))
65 ;; An encoded value (literal integer) has to be the second argument.
66 ((sc-is x immediate) (inst cmp y x-val))
68 (t (inst cmp x y-val))))
70 (inst jmp (if not-p :ne :e) target)))