master: Remove some nops for ancient MIPS I support

snuglas via Sbcl-commits <[email protected]>
Newsgroups gmane.lisp.steel-bank.cvs
Message-ID <[email protected]>
The branch "master" has been updated in SBCL:
       via  37d8c020ee1c9e57d14d2c4c26b95ee16a5c806c (commit)
      from  c652d1fb01331aa073d41cc92c0c97f7e3a6025b (commit)

- Log -----------------------------------------------------------------
commit 37d8c020ee1c9e57d14d2c4c26b95ee16a5c806c
Author: Douglas Katzman <[email protected]>
Date:   Sun Aug 16 20:46:07 2026 -0400

    Remove some nops for ancient MIPS I support
    
    Due to getting load delays wrong, we have never correctly run on MIPS I afaict
    so don't even try. MIPS II has branch delays and also there are some
    coprocessor hazards that still need delays, therefore keep those intact.
---
 src/compiler/mips/array.lisp  | 13 ++++-------
 src/compiler/mips/float.lisp  | 52 ++++++++++++++-----------------------------
 src/compiler/mips/sap.lisp    |  6 ++---
 src/compiler/mips/system.lisp |  5 +----
 4 files changed, 24 insertions(+), 52 deletions(-)

diff --git a/src/compiler/mips/array.lisp b/src/compiler/mips/array.lisp
index 2f0ec2a96..50eb62692 100644
--- a/src/compiler/mips/array.lisp
+++ b/src/compiler/mips/array.lisp
@@ -58,7 +58,6 @@
     ;; ASSUMPTION: n-widetag-bits = 8 and rank is adjacent to widetag
     (inst lbu res x #+little-endian (- 1 other-pointer-lowtag)
                     #+big-endian    (- 2 other-pointer-lowtag))
-    (inst nop)
     (inst addu res 1)
     (inst and res array-rank-mask)))
 
@@ -336,8 +335,7 @@
     (inst addu lip object index)
     (inst lwc1 value lip
           (- (* vector-data-offset n-word-bytes)
-             other-pointer-lowtag))
-    (inst nop)))
+             other-pointer-lowtag))))
 
 (define-vop (data-vector-set/simple-array-single-float)
   (:note "inline array store")
@@ -383,8 +381,7 @@
        (inst lwc1-odd value lip
              (+ (- (* vector-data-offset n-word-bytes)
                    other-pointer-lowtag)
-                n-word-bytes))))
-    (inst nop)))
+                n-word-bytes))))))
 
 (define-vop (data-vector-set/simple-array-double-float)
   (:note "inline array store")
@@ -435,8 +432,7 @@
                                 other-pointer-lowtag)))
     (let ((imag-tn (complex-single-reg-imag-tn value)))
       (inst lwc1 imag-tn lip (- (* (1+ vector-data-offset) n-word-bytes)
-                                other-pointer-lowtag)))
-    (inst nop)))
+                                other-pointer-lowtag)))))
 
 (define-vop (data-vector-set/simple-array-complex-single-float)
   (:note "inline array store")
@@ -477,8 +473,7 @@
                                 other-pointer-lowtag)))
     (let ((imag-tn (complex-double-reg-imag-tn value)))
       (ld-double imag-tn lip (- (* (+ vector-data-offset 2) n-word-bytes)
-                                other-pointer-lowtag)))
-    (inst nop)))
+                                other-pointer-lowtag)))))
 
 (define-vop (data-vector-set/simple-array-complex-double-float)
   (:note "inline array store")
diff --git a/src/compiler/mips/float.lisp b/src/compiler/mips/float.lisp
index d13f336ff..59f1c5b6c 100644
--- a/src/compiler/mips/float.lisp
+++ b/src/compiler/mips/float.lisp
@@ -15,8 +15,7 @@
 ;;;; Move functions:
 (define-move-fun (load-single 1) (vop x y)
   ((single-stack) (single-reg))
-  (inst lwc1 y (current-nfp-tn vop) (tn-byte-offset x))
-  (inst nop))
+  (inst lwc1 y (current-nfp-tn vop) (tn-byte-offset x)))
 
 (define-move-fun (store-single 1) (vop x y)
   ((single-reg) (single-stack))
@@ -35,8 +34,7 @@
   ((double-stack) (double-reg))
   (let ((nfp (current-nfp-tn vop))
         (offset (tn-byte-offset x)))
-    (ld-double y nfp offset))
-  (inst nop))
+    (ld-double y nfp offset)))
 
 (defun str-double (x base offset)
   (ecase *backend-byte-order*
@@ -119,8 +117,7 @@
                            ,@(when double-p
                                `((inst lwc1-odd y x
                                        (- (* (1+ ,value) n-word-bytes)
-                                          other-pointer-lowtag)))))))
-                    (inst nop)))
+                                          other-pointer-lowtag)))))))))
                 (define-move-vop ,name :move (descriptor-reg) (,sc)))))
   (frob move-to-single single-reg nil single-float-value-slot)
   (frob move-to-double double-reg t double-float-value-slot))
@@ -177,8 +174,7 @@
     (let ((real-tn (complex-single-reg-real-tn y)))
       (inst lwc1 real-tn nfp offset))
     (let ((imag-tn (complex-single-reg-imag-tn y)))
-      (inst lwc1 imag-tn nfp (+ offset n-word-bytes))))
-  (inst nop))
+      (inst lwc1 imag-tn nfp (+ offset n-word-bytes)))))
 
 (define-move-fun (store-complex-single 2) (vop x y)
   ((complex-single-reg) (complex-single-stack))
@@ -196,8 +192,7 @@
     (let ((real-tn (complex-double-reg-real-tn y)))
       (ld-double real-tn nfp offset))
     (let ((imag-tn (complex-double-reg-imag-tn y)))
-      (ld-double imag-tn nfp (+ offset (* 2 n-word-bytes))))
-    (inst nop)))
+      (ld-double imag-tn nfp (+ offset (* 2 n-word-bytes))))))
 
 (define-move-fun (store-complex-double 4) (vop x y)
   ((complex-double-reg) (complex-double-stack))
@@ -298,8 +293,7 @@
                               other-pointer-lowtag)))
     (let ((imag-tn (complex-single-reg-imag-tn y)))
       (inst lwc1 imag-tn x (- (* complex-single-float-imag-slot n-word-bytes)
-                              other-pointer-lowtag)))
-    (inst nop)))
+                              other-pointer-lowtag)))))
 (define-move-vop move-to-complex-single :move
   (descriptor-reg) (complex-single-reg))
 
@@ -313,8 +307,7 @@
                               other-pointer-lowtag)))
     (let ((imag-tn (complex-double-reg-imag-tn y)))
       (ld-double imag-tn x (- (* complex-double-float-imag-slot n-word-bytes)
-                              other-pointer-lowtag)))
-    (inst nop)))
+                              other-pointer-lowtag)))))
 (define-move-vop move-to-complex-double :move
   (descriptor-reg) (complex-double-reg))
 
@@ -383,8 +376,7 @@
        (inst mfc1 y x))
       (descriptor-reg
        (inst lw y x (- (* single-float-value-slot n-word-bytes)
-                       other-pointer-lowtag))))
-    (inst nop)))                        ;nop needed here?
+                       other-pointer-lowtag))))))
 (define-move-vop move-to-single-int-reg
     :move (single-reg descriptor-reg) (single-int-carg-reg))
 
@@ -417,8 +409,7 @@
        (inst lw y x (- (* double-float-value-slot n-word-bytes)
                        other-pointer-lowtag))
        (inst lw-odd y x (- (* (1+ double-float-value-slot) n-word-bytes)
-                           other-pointer-lowtag))))
-    (inst nop)))                        ;nop needed here?
+                           other-pointer-lowtag))))))
 (define-move-vop move-to-double-int-reg
     :move (double-reg descriptor-reg) (double-int-carg-reg))
 
@@ -507,7 +498,7 @@
   (:generator 3
     (note-this-location vop :internal-error)
     (inst fcmp operation format x y)
-    (inst nop)
+    (inst nop) ; FPU condition code hazard was not eliminated until MIPS IV
     (if (if complement (not not-p) not-p)
         (inst bc1f target)
         (inst bc1t target))
@@ -555,7 +546,6 @@
                   (:generator ,(if word-p 3 2)
                     ,@(if word-p
                           `((inst mtc1 y x)
-                            (inst nop)
                             (note-this-location vop :internal-error)
                             (inst fcvt ,to-format :word y y))
                           `((note-this-location vop :internal-error)
@@ -589,8 +579,7 @@
                 (:generator 3
                   (note-this-location vop :internal-error)
                   (inst fcvt :word ,from-format temp x)
-                  (inst mfc1 y temp)
-                  (inst nop)))))
+                  (inst mfc1 y temp)))))
   (frob %unary-round/single-float single-reg single-float :single)
   (frob %unary-round/double-float double-reg double-float :double))
 
@@ -629,7 +618,6 @@
                     (note-this-location vop :internal-error)
                     (inst fcvt :word ,from-format temp x)
                     (inst mfc1 y temp)
-                    (inst nop)
                     (inst ctc1 status-save 31))))))
   (frob %unary-truncate/single-float single-reg single-float :single)
   (frob %unary-truncate/double-float double-reg double-float :double))
@@ -643,8 +631,7 @@
   (:translate make-single-float)
   (:policy :fast-safe)
   (:generator 2
-    (inst mtc1 res bits)
-    (inst nop)))
+    (inst mtc1 res bits)))
 
 (define-vop (make-double-float)
   (:args (hi-bits :scs (signed-reg))
@@ -656,8 +643,7 @@
   (:policy :fast-safe)
   (:generator 2
     (inst mtc1 res lo-bits)
-    (inst mtc1-odd res hi-bits)
-    (inst nop)))
+    (inst mtc1-odd res hi-bits)))
 
 (define-vop (single-float-bits)
   (:args (float :scs (single-reg)))
@@ -667,8 +653,7 @@
   (:translate single-float-bits)
   (:policy :fast-safe)
   (:generator 2
-    (inst mfc1 bits float)
-    (inst nop)))
+    (inst mfc1 bits float)))
 
 (define-vop (double-float-high-bits)
   (:args (float :scs (double-reg)))
@@ -678,8 +663,7 @@
   (:translate double-float-high-bits)
   (:policy :fast-safe)
   (:generator 2
-    (inst mfc1-odd hi-bits float)
-    (inst nop)))
+    (inst mfc1-odd hi-bits float)))
 
 (define-vop (double-float-low-bits)
   (:args (float :scs (double-reg)))
@@ -768,8 +752,7 @@
       (complex-single-stack
        (inst lwc1 r (current-nfp-tn vop) (* (+ (ecase slot (:real 0) (:imag 1))
                                                (tn-offset x))
-                                            n-word-bytes))
-       (inst nop)))))
+                                            n-word-bytes))))))
 
 (define-vop (realpart/complex-single-float complex-single-float-value)
   (:translate realpart)
@@ -801,8 +784,7 @@
       (complex-double-stack
        (ld-double r (current-nfp-tn vop) (* (+ (ecase slot (:real 0) (:imag 2))
                                                (tn-offset x))
-                                            n-word-bytes))
-       (inst nop)))))
+                                            n-word-bytes))))))
 
 (define-vop (realpart/complex-double-float complex-double-float-value)
   (:translate realpart)
diff --git a/src/compiler/mips/sap.lisp b/src/compiler/mips/sap.lisp
index f52b00ce8..ac332cec9 100644
--- a/src/compiler/mips/sap.lisp
+++ b/src/compiler/mips/sap.lisp
@@ -178,8 +178,7 @@
                        (inst lwc1-odd result sap 0)))
                     (:little-endian
                      '((inst lwc1 result sap 0)
-                       (inst lwc1-odd result sap n-word-bytes))))))
-           (inst nop)))
+                       (inst lwc1-odd result sap n-word-bytes))))))))
        (define-vop (,(symbolicate ref-name "-C"))
          (:translate ,ref-name)
          (:policy :fast-safe)
@@ -214,8 +213,7 @@
                      (inst lwc1-odd result object offset)))
                   (:little-endian
                    '((inst lwc1 result object offset)
-                     (inst lwc1-odd result object (+ offset n-word-bytes)))))))
-           (inst nop)))
+                     (inst lwc1-odd result object (+ offset n-word-bytes)))))))))
        (define-vop (,set-name)
          (:translate ,set-name)
          (:policy :fast-safe)
diff --git a/src/compiler/mips/system.lisp b/src/compiler/mips/system.lisp
index 47bac2f73..9898944ab 100644
--- a/src/compiler/mips/system.lisp
+++ b/src/compiler/mips/system.lisp
@@ -83,7 +83,6 @@
                      (- instance-pointer-lowtag))))
       (inst lw test-id sb-vm::code-tn label)
       (inst lw this-id x offset)
-      (inst nop)
       (inst* (if not-p 'bne 'beq) this-id test-id target)
       (inst nop))))
 
@@ -198,8 +197,7 @@
     (inst add res offset res)
     (inst subu res other-pointer-lowtag)
     (inst add lip code res)
-    (inst lw res lip 0)
-    (inst nop)))
+    (inst lw res lip 0)))
 
 (define-vop (compute-fun)
   (:args (code :scs (descriptor-reg))
@@ -240,7 +238,6 @@
     (let ((offset
            (- (* (+ index vector-data-offset) n-word-bytes) other-pointer-lowtag)))
       (inst lw count count-vector offset)
-      (inst nop)
       (inst addu count 1)
       (inst sw count count-vector offset))))
 

-----------------------------------------------------------------------


hooks/post-receive
-- 
SBCL
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.