the R5900's FPU (coprocessor 1): single precision only, not IEEE 754.
0/1 a fixed bit, name a field, a bit the decoder ignores
mfc1 rt fs
Move Word from Floating Point
r5900:
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | rt | fs | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ||||||||
(defmips mfc1 (:only :r5900) (:asm "mfc1" rt fs) (:doc "Move Word from Floating Point")
(set-gpr rt (reg32 (fpr fs))))
mtc1 rt fs
Move Word to Floating Point
r5900:
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | rt | fs | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ||||||||
(defmips mtc1 (:only :r5900) (:asm "mtc1" rt fs) (:doc "Move Word to Floating Point")
(setf (fpr fs) (wrap 32 (gpr rt))))
cfc1 rt rd
Move Control Word from Floating Point
r5900:
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | rt | rd | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ||||||||
(defmips cfc1 (:only :r5900) (:asm "cfc1" rt rd) (:doc "Move Control Word from Floating Point")
(set-gpr rt (reg32 (case rd (31 (mips-fcr31 cpu)) (0 #x2E00) (t 0)))))
ctc1 rt rd
Move Control Word to Floating Point
r5900:
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 0 | rt | rd | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ||||||||
(defmips ctc1 (:only :r5900) (:asm "ctc1" rt rd) (:doc "Move Control Word to Floating Point")
(when (= rd 31) (setf (mips-fcr31 cpu) (wrap 32 (gpr rt)))))
lwc1 ft (simm imm) rs
Load Word to Floating Point
r5900:
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| 1 | 1 | 0 | 0 | 0 | 1 | rs | ft | imm | |||||||||||||||||||||||
(defmips lwc1 (:only :r5900) (:asm "lwc1" ft (simm imm) rs) (:doc "Load Word to Floating Point")
(let ((a (vaddr rs imm)))
(if (/= (wrap 2 a) 0)
(raise +exc-adel+)
(setf (fpr ft) (mips-load 32 a)))))
swc1 ft (simm imm) rs
Store Word from Floating Point
r5900:
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| 1 | 1 | 1 | 0 | 0 | 1 | rs | ft | imm | |||||||||||||||||||||||
(defmips swc1 (:only :r5900) (:asm "swc1" ft (simm imm) rs) (:doc "Store Word from Floating Point")
(let ((a (vaddr rs imm)))
(if (/= (wrap 2 a) 0)
(raise +exc-ades+)
(mips-store 32 a (fpr ft)))))
mov.s fd fs
Floating Point Move
r5900:
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | fs | fd | 0 | 0 | 0 | 1 | 1 | 0 | ||||||||
(defmips mov.s (:only :r5900) (:asm "mov.s" fd fs) (:doc "Floating Point Move")
(setf (fpr fd) (fpr fs)))
add.s fd fs ft
Floating Point Add
r5900:
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | ft | fs | fd | 0 | 0 | 0 | 0 | 0 | 0 | ||||||||||||
(defmips add.s (:only :r5900) (:asm "add.s" fd fs ft) (:doc "Floating Point Add")
(fpu-set (fpr fd) (ee-fadd (fpr fs) (fpr ft)) +ef-ou+))
sub.s fd fs ft
Floating Point Subtract
r5900:
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | ft | fs | fd | 0 | 0 | 0 | 0 | 0 | 1 | ||||||||||||
(defmips sub.s (:only :r5900) (:asm "sub.s" fd fs ft) (:doc "Floating Point Subtract")
(fpu-set (fpr fd) (ee-fsub (fpr fs) (fpr ft)) +ef-ou+))
mul.s fd fs ft
Floating Point Multiply
r5900:
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | ft | fs | fd | 0 | 0 | 0 | 0 | 1 | 0 | ||||||||||||
(defmips mul.s (:only :r5900) (:asm "mul.s" fd fs ft) (:doc "Floating Point Multiply")
(fpu-set (fpr fd) (ee-fmul (fpr fs) (fpr ft)) +ef-ou+))
div.s fd fs ft
Floating Point Divide
r5900:
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | ft | fs | fd | 0 | 0 | 0 | 0 | 1 | 1 | ||||||||||||
(defmips div.s (:only :r5900) (:asm "div.s" fd fs ft) (:doc "Floating Point Divide")
(fpu-set (fpr fd) (ee-fdiv (fpr fs) (fpr ft)) (logior +ef-ou+ +ef-di+)))
sqrt.s fd ft
Floating Point Square Root
r5900:
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | fs | fd | 0 | 0 | 0 | 1 | 0 | 0 | ||||||||
r5900:
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | ft | 0 | 0 | 0 | 0 | 0 | fd | 0 | 0 | 0 | 1 | 0 | 0 | ||||||||
(defmips sqrt.s (:only :r5900) (:asm "sqrt.s" fd ft) (:doc "Floating Point Square Root")
(fpu-set (fpr fd) (ee-fsqrt (fpr ft)) +ef-di+))
rsqrt.s fd fs ft
Floating Point Reciprocal Square Root
r5900:
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | ft | fs | fd | 0 | 1 | 0 | 1 | 1 | 0 | ||||||||||||
(defmips rsqrt.s (:only :r5900) (:asm "rsqrt.s" fd fs ft) (:doc "Floating Point Reciprocal Square Root")
(fpu-set (fpr fd) (ee-frsqrt (fpr fs) (fpr ft)) (logior +ef-ou+ +ef-di+)))
abs.s fd fs
Floating Point Absolute Value
ABS.S, NEG.S: the sign bit only; O and U cleared
r5900:
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | fs | fd | 0 | 0 | 0 | 1 | 0 | 1 | ||||||||
(defmips abs.s (:only :r5900) (:asm "abs.s" fd fs) (:doc "Floating Point Absolute Value")
(fpu-set (fpr fd) (logand (fpr fs) #x7FFFFFFF) +ef-ou+))
neg.s fd fs
Floating Point Negate
r5900:
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | fs | fd | 0 | 0 | 0 | 1 | 1 | 1 | ||||||||
(defmips neg.s (:only :r5900) (:asm "neg.s" fd fs) (:doc "Floating Point Negate")
(fpu-set (fpr fd) (ee-fneg (fpr fs)) +ef-ou+))
adda.s fs ft
Floating Point Add to Accumulator
r5900:
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | ft | fs | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | ||||||||
(defmips adda.s (:only :r5900) (:asm "adda.s" fs ft) (:doc "Floating Point Add to Accumulator")
(fpu-set (mips-facc cpu) (ee-fadd (fpr fs) (fpr ft)) +ef-ou+))
suba.s fs ft
Floating Point Subtract to Accumulator
r5900:
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | ft | fs | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | ||||||||
(defmips suba.s (:only :r5900) (:asm "suba.s" fs ft) (:doc "Floating Point Subtract to Accumulator")
(fpu-set (mips-facc cpu) (ee-fsub (fpr fs) (fpr ft)) +ef-ou+))
mula.s fs ft
Floating Point Multiply to Accumulator
r5900:
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | ft | fs | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | ||||||||
(defmips mula.s (:only :r5900) (:asm "mula.s" fs ft) (:doc "Floating Point Multiply to Accumulator")
(fpu-set (mips-facc cpu) (ee-fmul (fpr fs) (fpr ft)) +ef-ou+))
madd.s fd fs ft
Floating Point Multiply-Add
MADD.S: "fd <- ACC + fs * ft"; MSUB.S: "fd <- ACC - fs * ft"
r5900:
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | ft | fs | fd | 0 | 1 | 1 | 1 | 0 | 0 | ||||||||||||
(defmips madd.s (:only :r5900) (:asm "madd.s" fd fs ft) (:doc "Floating Point Multiply-Add")
(fpu-set (fpr fd) (fpu-madd (mips-facc cpu) (fpr fs) (fpr ft) nil) +ef-ou+))
msub.s fd fs ft
Floating Point Multiply-Subtract
r5900:
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | ft | fs | fd | 0 | 1 | 1 | 1 | 0 | 1 | ||||||||||||
(defmips msub.s (:only :r5900) (:asm "msub.s" fd fs ft) (:doc "Floating Point Multiply-Subtract")
(fpu-set (fpr fd) (fpu-madd (mips-facc cpu) (fpr fs) (fpr ft) t) +ef-ou+))
madda.s fs ft
Floating Point Multiply-Add to Accumulator
r5900:
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | ft | fs | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 0 | ||||||||
(defmips madda.s (:only :r5900) (:asm "madda.s" fs ft) (:doc "Floating Point Multiply-Add to Accumulator")
(fpu-set (mips-facc cpu) (fpu-madd (mips-facc cpu) (fpr fs) (fpr ft) nil) +ef-ou+))
msuba.s fs ft
Floating Point Multiply-Subtract to Accumulator
r5900:
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | ft | fs | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | ||||||||
(defmips msuba.s (:only :r5900) (:asm "msuba.s" fs ft) (:doc "Floating Point Multiply-Subtract to Accumulator")
(fpu-set (mips-facc cpu) (fpu-madd (mips-facc cpu) (fpr fs) (fpr ft) t) +ef-ou+))
max.s fd fs ft
Floating Point Maximum
r5900:
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | ft | fs | fd | 1 | 0 | 1 | 0 | 0 | 0 | ||||||||||||
(defmips max.s (:only :r5900) (:asm "max.s" fd fs ft) (:doc "Floating Point Maximum")
(fpu-set (fpr fd) (ee-fmax (fpr fs) (fpr ft)) +ef-ou+))
min.s fd fs ft
Floating Point Minimum
r5900:
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | ft | fs | fd | 1 | 0 | 1 | 0 | 0 | 1 | ||||||||||||
(defmips min.s (:only :r5900) (:asm "min.s" fd fs ft) (:doc "Floating Point Minimum")
(fpu-set (fpr fd) (ee-fmin (fpr fs) (fpr ft)) +ef-ou+))
cvt.s.w fd fs
Fixed-point Convert to Single Floating Point
r5900:
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | fs | fd | 1 | 0 | 0 | 0 | 0 | 0 | ||||||||
(defmips cvt.s.w (:only :r5900) (:asm "cvt.s.w" fd fs) (:doc "Fixed-point Convert to Single Floating Point")
(setf (fpr fd) (wrap 32 (ee-fcvt-sw (fpr fs)))))
cvt.w.s fd fs
Floating Point Convert to Word Fixed-point
CVT.W.S (binutils' trunc.w.s for the R5900): toward zero, saturating
r5900:
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | fs | fd | 1 | 0 | 0 | 1 | 0 | 0 | ||||||||
(defmips trunc.w.s (:only :r5900) (:asm "cvt.w.s" fd fs) (:doc "Floating Point Convert to Word Fixed-point")
(setf (fpr fd) (ee-fcvt-ws (fpr fs))))
c.f.s fs ft
Floating Point Compare False
r5900:
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | ft | fs | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | ||||||||
(defmips c.f.s (:only :r5900) (:asm "c.f.s" fs ft) (:doc "Floating Point Compare False")
(set-fcc nil))
c.eq.s fs ft
Floating Point Compare Equal
r5900:
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | ft | fs | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | ||||||||
(defmips c.eq.s (:only :r5900) (:asm "c.eq.s" fs ft) (:doc "Floating Point Compare Equal")
(set-fcc (= (ee-feq (fpr fs) (fpr ft)) 1)))
c.lt.s fs ft
Floating Point Compare Less Than
r5900:
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | ft | fs | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | ||||||||
(defmips c.lt.s (:only :r5900) (:asm "c.lt.s" fs ft) (:doc "Floating Point Compare Less Than")
(set-fcc (= (ee-flt (fpr fs) (fpr ft)) 1)))
c.le.s fs ft
Floating Point Compare Less Than or Equal
r5900:
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | ft | fs | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 0 | ||||||||
(defmips c.le.s (:only :r5900) (:asm "c.le.s" fs ft) (:doc "Floating Point Compare Less Than or Equal")
(set-fcc (= (ee-fle (fpr fs) (fpr ft)) 1)))
bc1f (b-rel offset)
Branch on FP False
r5900:
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | offset | |||||||||||||||
(defmips bc1f (:only :r5900) (:asm "bc1f" (b-rel offset)) (:doc "Branch on FP False")
(when (= (fcc) 0) (branch-to (branch-target offset))))
bc1t (b-rel offset)
Branch on FP True
r5900:
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | offset | |||||||||||||||
(defmips bc1t (:only :r5900) (:asm "bc1t" (b-rel offset)) (:doc "Branch on FP True")
(when (= (fcc) 1) (branch-to (branch-target offset))))
bc1fl (b-rel offset)
Branch on FP False Likely
r5900:
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | offset | |||||||||||||||
(defmips bc1fl (:only :r5900) (:asm "bc1fl" (b-rel offset)) (:doc "Branch on FP False Likely")
(if (= (fcc) 0) (branch-to (branch-target offset)) (nullify)))
bc1tl (b-rel offset)
Branch on FP True Likely
r5900:
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | offset | |||||||||||||||
(defmips bc1tl (:only :r5900) (:asm "bc1tl" (b-rel offset)) (:doc "Branch on FP True Likely")
(if (= (fcc) 1) (branch-to (branch-target offset)) (nullify)))
(defmacro fpr) source(defmacro fpr (n) `(aref (mips-fpr cpu) ,n))(defconstant +fcr-c+) source(defconstant +fcr-c+ #x800000)(defmacro ef-cur) source(defmacro ef-cur (f)
`(logior (ash (bit-at ,f 0) 15) (ash (bit-at ,f 1) 14) (ash (bit-at ,f 2) 16) (ash (bit-at ,f 3) 17)))(defmacro ef-sticky) source(defmacro ef-sticky (f)
`(logior (ash (bit-at ,f 0) 4) (ash (bit-at ,f 1) 3) (ash (bit-at ,f 2) 5) (ash (bit-at ,f 3) 6)))(defun ee-fcr31) source(defun ee-fcr31 (fcr flags track)
"FCR31 after an operation that raised FLAGS and updates the flags TRACK
(both EF-... sets): TRACK's current flags replaced, sticky ones added"
(declare (type (unsigned-byte 32) fcr) (type (unsigned-byte 4) flags track))
(let ((f (logand flags track)))
(logior (logand fcr (wrap 32 (lognot (ef-cur track)))) (ef-cur f) (ef-sticky f))))(defmacro fpu-set) source(defmacro fpu-set (dest r track)
`(let ((v ,r))
(setf ,dest (wrap 32 v)
(mips-fcr31 cpu) (ee-fcr31 (mips-fcr31 cpu) (bit-field v 32 4) ,track))))(defconstant +ef-ou+) source(defconstant +ef-ou+ 3)(defconstant +ef-di+) source(defconstant +ef-di+ 12)(defmacro fpu-madd) source(defmacro fpu-madd (acc a b sub)
`(let* ((p (ee-fmul ,a ,b))
(r (ee-fadd ,acc (wrap 32 ,(if sub '(ee-fneg (wrap 32 p)) 'p)))))
(logior r (logand p #xF00000000))))(defmacro set-fcc) source(defmacro set-fcc (test)
`(setf (mips-fcr31 cpu) (if ,test
(logior (mips-fcr31 cpu) +fcr-c+)
(logand (mips-fcr31 cpu) (wrap 32 (lognot +fcr-c+))))))(defmacro fcc) source(defmacro fcc () `(bit-at (mips-fcr31 cpu) 23))Made from xspe at b2fac33349db by tools/gen-xspe.py. xspe is GPL-3.0-or-later.