Skip to content
Snippets Groups Projects
Commit 538d639c authored by wlott's avatar wlott
Browse files

Changed three-way-comparison to a function and fixed a bug in the :gt

branch.
parent b0a787c4
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
;;; Scott Fahlman (FAHLMAN@CMUC). ;;; Scott Fahlman (FAHLMAN@CMUC).
;;; ********************************************************************** ;;; **********************************************************************
;;; ;;;
;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/mips/macros.lisp,v 1.36 1990/07/05 22:21:26 wlott Exp $ ;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/mips/macros.lisp,v 1.37 1990/07/16 13:17:37 wlott Exp $
;;; ;;;
;;; This file contains various useful macros for generating MIPS code. ;;; This file contains various useful macros for generating MIPS code.
;;; ;;;
...@@ -167,39 +167,31 @@ ...@@ -167,39 +167,31 @@
;;;; Three Way Comparison ;;;; Three Way Comparison
(defmacro three-way-comparison (x y condition flavor not-p target temp) (defun three-way-comparison (x y condition flavor not-p target temp)
(once-only ((n-x x) (ecase condition
(n-y y) (:eq
(n-condition condition) (if not-p
(n-flavor flavor) (inst bne x y target)
(n-not-p not-p) (inst beq x y target)))
(n-target target) (:lt
(n-temp temp)) (ecase flavor
`(progn (:unsigned
(ecase ,n-condition (inst sltu temp x y))
(:eq (:signed
(if ,n-not-p (inst slt temp x y)))
(inst bne ,n-x ,n-y ,n-target) (if not-p
(inst beq ,n-x ,n-y ,n-target))) (inst beq temp zero-tn target)
(:lt (inst bne temp zero-tn target)))
(ecase ,n-flavor (:gt
(:unsigned (ecase flavor
(inst sltu ,n-temp ,n-x ,n-y)) (:unsigned
(:signed (inst sltu temp y x))
(inst slt ,n-temp ,n-x ,n-y))) (:signed
(if ,n-not-p (inst slt temp y x)))
(inst beq ,n-temp zero-tn ,n-target) (if not-p
(inst bne ,n-temp zero-tn ,n-target))) (inst beq temp zero-tn target)
(:gt (inst bne temp zero-tn target))))
(ecase ,n-flavor (inst nop))
(:unsigned
(inst sltu ,n-temp ,n-y ,n-x))
(:signed
(inst slt ,n-temp ,n-y ,n-x)))
(if ,n-not-p
(inst bne ,n-temp zero-tn ,n-target)
(inst beq ,n-temp zero-tn ,n-target))))
(inst nop))))
;;;; Simple Type Checking Macros ;;;; Simple Type Checking Macros
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment