Skip to content
Snippets Groups Projects
Commit 55adc339 authored by wlott's avatar wlott
Browse files

Filled in the truncate assembly routine.

parent 86f8ef31
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
;;; Scott Fahlman or slisp-group@cs.cmu.edu. ;;; Scott Fahlman or slisp-group@cs.cmu.edu.
;;; ;;;
(ext:file-comment (ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/assembly/hppa/arith.lisp,v 1.1 1992/06/12 03:59:11 wlott Exp $") "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/assembly/hppa/arith.lisp,v 1.2 1992/06/13 10:11:02 wlott Exp $")
;;; ;;;
;;; ********************************************************************** ;;; **********************************************************************
;;; ;;;
...@@ -67,11 +67,35 @@ ...@@ -67,11 +67,35 @@
(inst add res sign res)) (inst add res sign res))
#+assembly #+assembler
(define-assembly-routine (define-assembly-routine
(truncate) (truncate)
() ((:arg dividend signed-reg nl0-offset)
...) (:arg divisor signed-reg nl1-offset)
(:res quo signed-reg nl2-offset)
(:res rem signed-reg nl3-offset))
;; Move abs(divident) into quo.
(inst move dividend quo :>=)
(inst sub zero-tn quo quo)
;; Do one divive-step with -divisor to prime V (use rem as a temp)
(inst sub zero-tn divisor rem)
(inst ds zero-tn rem zero-tn)
;; Shift the divident/quotient one bit, setting the carry flag.
(inst add quo quo quo)
;; The first real divive-step.
(inst ds zero-tn divisor rem)
(inst addc quo quo quo)
;; And 31 more of them.
(dotimes (i 31)
(inst ds rem divisor rem)
(inst addc quo quo quo))
;; Now we have to fix the signs of quo and rem.
(inst xor divisor dividend zero-tn :>=)
(inst sub zero-tn quo quo)
(inst move dividend zero-tn :>=)
(inst sub zero-tn rem rem))
......
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