-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathifunloop.ppcs
78 lines (44 loc) · 2.4 KB
/
ifunloop.ppcs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
;;; -*- Mode: LISP; Syntax: Common-Lisp; Package: ALPHA-AXP-INTERNALS; Base: 10; Lowercase: T -*-
;(include-header "aihead.s")
;(include-header "aistat.s")
;(include-header "ifunhead.s")
(comment "Branch and loop instructions.")
;;; First the most commonly used branches
;; |DoBranch| is in IFUNCOM1.PPCS
;; |DoBranchTrue| and |DoBranchFalse| are in IFUNCOM1.PPCS
;; |DoBranchTrueNoPop| and |DoBranchFalseNoPop| is is IFUNCOM1.PPCS
;; |DoBranchTrueAndExtraPop| and |DoBranchFalseAndExtraPop| are in IFUNCOM2.PPCS
;; |DoBranchTrueAndNoPop| and |DoBranchFalseAndNoPop| are in IFUNCOM2.PPCS
(define-instruction |DoBranchTrueElseNoPop| :10-bit-signed-immediate
(:own-immediate t :needs-tos t)
(ibranchcond nil t nil nil |BranchException|)) ;and-pop
;; |DoBranchFalseElseNoPop| is in IFUNCOM2.PPCS
(define-instruction |DoBranchTrueElseExtraPop| :10-bit-signed-immediate
(:own-immediate t :needs-tos t)
(ibranchcond nil nil t t |BranchException|)) ;else-pop extra-pop
(define-instruction |DoBranchFalseElseExtraPop| :10-bit-signed-immediate
(:own-immediate t :needs-tos t)
(ibranchcond t nil t t |BranchException|)) ;invert else-pop extra-pop
;; |DoBranchTrueExtraPop| is less commonly used, so it's down below
(define-instruction |DoBranchFalseExtraPop| :10-bit-signed-immediate
(:own-immediate t :needs-tos t)
(ibranchcond t t t t |BranchException|)) ;invert and-pop else-pop extra-pop
;;; Then the loop instructions
(define-instruction |DoLoopDecrementTos| :10-bit-signed-immediate (:needs-tos t)
(iloop-decrement-tos))
(define-instruction |DoLoopIncrementTosLessThan| :10-bit-signed-immediate (:needs-tos t)
(iloop-increment-tos-less-than))
;;; Finally the less commonly used branches
(define-instruction |DoBranchTrueExtraPop| :10-bit-signed-immediate
(:own-immediate t :needs-tos t)
(ibranchcond nil t t t |BranchException|)) ;and-pop else-pop extra-pop
(define-instruction |DoBranchTrueAndNoPopElseNoPopExtraPop| :10-bit-signed-immediate
(:own-immediate t :needs-tos t)
(ibranchcond nil nil nil t |BranchException|)) ;extra-pop
(define-instruction |DoBranchFalseAndNoPopElseNoPopExtraPop| :10-bit-signed-immediate
(:own-immediate t :needs-tos t)
(ibranchcond t nil nil t |BranchException|)) ;invert extra-pop
;; All conditional branch exceptions end up here
(define-procedure |BranchException| ()
(illegal-operand branch-dot-error))
(comment "Fin.")