[PATCH 13/13] Recognize loongarch64 path in tests

[email protected]
Newsgroups gmane.lisp.steel-bank.devel
Message-ID <[email protected]>
This patch updates tests to correctly recognize LoongArch64 paths.

_______________________________________________
Sbcl-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sbcl-devel
0013-recognize-loongarch64-path-in-tests.patch (application/octet-stream, 14 KB)
From dfeec42a38415ec6552791e7a9868bd5331bfe05 Mon Sep 17 00:00:00 2001
From: ZiLong Wang <[email protected]>
Date: Mon, 19 Jan 2026 09:07:18 +0800
Subject: [PATCH 13/13] recognize loongarch path in tests

---
 tests/arith-2.pure.lisp                   | 11 ++++++-----
 tests/array.pure.lisp                     |  2 +-
 tests/compare-and-swap.impure.lisp        |  6 +++---
 tests/compiler.impure.lisp                |  2 +-
 tests/compiler.pure.lisp                  |  4 ++--
 tests/constraint.pure.lisp                |  2 +-
 tests/debug.impure.lisp                   |  6 +++---
 tests/float.pure.lisp                     |  4 ++--
 tests/foreign-stack-alignment.impure.lisp |  1 +
 tests/gethash-concurrency.pure.lisp       | 16 ++++++++++------
 tests/hash-table.impure.lisp              |  2 +-
 tests/make-thread.pure.lisp               |  4 ++--
 tests/step.pure.lisp                      |  2 +-
 tests/threads.impure.lisp                 |  4 ++--
 14 files changed, 36 insertions(+), 30 deletions(-)

diff --git a/tests/arith-2.pure.lisp b/tests/arith-2.pure.lisp
index 0e5a1baeb..10f8ceb56 100644
--- a/tests/arith-2.pure.lisp
+++ b/tests/arith-2.pure.lisp
@@ -417,7 +417,7 @@
 
 (with-test (:name :signed-byte-8-p-unsigned
                   ;; these lack the necessary RANGE<= vop
-                  :fails-on (:or :mips :ppc :ppc64 :sparc :riscv))
+                  :fails-on (:or :mips :ppc :ppc64 :sparc :riscv :loongarch64))
   (checked-compile
    `(lambda (a)
       (declare (type (simple-array sb-vm:word (*)) a)
@@ -586,7 +586,7 @@
    (values (integer -255 0) (integer -9 0) &optional)))
 
 (with-test (:name :logbitp-on-integers
-            :fails-on :arm)
+            :fails-on :arm :loongarch)
   (assert (not (ctu:ir1-named-calls `(lambda (x)
                                        (logbitp 20 x))))))
 (with-test (:name :bt-negative-bit)
@@ -766,7 +766,8 @@
       n))
    (unsigned-byte 54)))
 
-(with-test (:name :ldb-computed-posn)
+(with-test (:name :ldb-computed-posn
+	    :fails-on (or :loongarch64))
   (assert-type
    (lambda (x y)
      (ldb (byte y (- 32 y)) x))
@@ -820,7 +821,7 @@
    ((300 0) 303)))
 
 (with-test (:name :truncate-unknown-integer
-            :fails-on :arm)
+            :fails-on (or :arm :loongarch64))
   (assert (not (ctu:ir1-named-calls `(lambda (x)
                                        (declare (integer x))
                                        (values (the (signed-byte 25) (floor x 2)))))))
@@ -841,7 +842,7 @@
                                        (values (the (signed-byte 25) (ceiling x 2))))))))
 
 (with-test (:name :word-floor-ceiling
-            :fails-on :arm)
+            :fails-on (or :arm :loongarch64))
   (assert (not (ctu:ir1-named-calls `(lambda (x y)
                                        (declare (sb-vm:signed-word x y))
                                        (floor x y)))))
diff --git a/tests/array.pure.lisp b/tests/array.pure.lisp
index 5f181e0c9..5fa3fc31a 100644
--- a/tests/array.pure.lisp
+++ b/tests/array.pure.lisp
@@ -605,7 +605,7 @@
     (('(or (eql -16) unsigned-byte)) #(0) :test #'equalp)))
 
 (with-test (:name :check-bound-signed-bound-notes
-            :fails-on (not (or :x86-64 :x86 :arm64)))
+            :fails-on (not (or :x86-64 :x86 :arm64 :loongarch64)))
   (checked-compile-and-assert
       (:allow-notes nil)
       `(lambda (x y)
diff --git a/tests/compare-and-swap.impure.lisp b/tests/compare-and-swap.impure.lisp
index 8f7a2b092..c6af87ae8 100644
--- a/tests/compare-and-swap.impure.lisp
+++ b/tests/compare-and-swap.impure.lisp
@@ -628,7 +628,7 @@
       (format t "Double-width compare-and-swap NOT TESTED~%")))
 
 (test-util:with-test (:name :cas-sap-ref-smoke-test
-                            :fails-on :riscv ; unsigned-32-bit gets the wrong answer
+                            :fails-on (or :riscv :loongarch64) ; unsigned-32-bit gets the wrong answer
                             :skipped-on (not :sb-thread))
   (let ((data (make-array 1 :element-type 'sb-vm:word)))
     (sb-sys:with-pinned-objects (data)
@@ -656,8 +656,8 @@
           (test nil 32 #xbabab00e)
           ;; on riscv I did not implement these sizes, and
           ;; ppc64 might get "illegal instruction" depending on the particular CPU
-          #-(or riscv ppc64) (test nil 16 #xfafa)
-          #-(or riscv ppc64) (test nil 8 #xbb)
+          #-(or riscv ppc64 loongarch64) (test nil 16 #xfafa)
+          #-(or riscv ppc64 loongarch64) (test nil 8 #xbb)
           )
         ;; SAP-REF-SAP
         (setf (aref data 0) 0)
diff --git a/tests/compiler.impure.lisp b/tests/compiler.impure.lisp
index a206a18b0..26e245bf6 100644
--- a/tests/compiler.impure.lisp
+++ b/tests/compiler.impure.lisp
@@ -2810,7 +2810,7 @@
 (with-test (:name :ftype-return-type-conflict
             ;; Not having UNWIND-TO-FRAME-AND-CALL-VOP changes
             ;; the condition type here?
-            :fails-on (not :unwind-to-frame-and-call-vop))
+            :fails-on (not (or :unwind-to-frame-and-call-vop :loongarch)))
   (proclaim '(ftype (function () fixnum) ftype-return-type-conflict))
   (checked-compile-and-assert (:optimize :safe :allow-warnings t)
       `(sb-int:named-lambda ftype-return-type-conflict () nil)
diff --git a/tests/compiler.pure.lisp b/tests/compiler.pure.lisp
index 0bfc28e76..f67ef2022 100644
--- a/tests/compiler.pure.lisp
+++ b/tests/compiler.pure.lisp
@@ -5522,7 +5522,7 @@
   (let ((f (checked-compile '(lambda (x) (oddp x)))))
     (ctu:assert-no-consing (funcall f most-positive-fixnum))))
 (with-test (:name (oddp bignum :no-consing)
-            :serial t :skipped-on :interpreter :fails-on (or :arm :ppc))
+            :serial t :skipped-on :interpreter :fails-on (or :arm :ppc :loongarch))
   (let ((f (checked-compile '(lambda (x) (oddp x))))
         (x (* most-positive-fixnum most-positive-fixnum 3)))
     (ctu:assert-no-consing (funcall f x))))
@@ -5531,7 +5531,7 @@
   (let ((f (checked-compile '(lambda (x) (logtest x most-positive-fixnum)))))
     (ctu:assert-no-consing (funcall f 1))))
 (with-test (:name (logtest bignum :no-consing)
-            :serial t :skipped-on :interpreter :fails-on (or :arm :ppc))
+            :serial t :skipped-on :interpreter :fails-on (or :arm :ppc :loongarch))
   (let ((f (checked-compile '(lambda (x) (logtest x 1))))
         (x (* most-positive-fixnum most-positive-fixnum 3)))
     (ctu:assert-no-consing (funcall f x))))
diff --git a/tests/constraint.pure.lisp b/tests/constraint.pure.lisp
index 470935fbe..64c0f54a4 100644
--- a/tests/constraint.pure.lisp
+++ b/tests/constraint.pure.lisp
@@ -1909,7 +1909,7 @@
    (integer -6176139011 -222)))
 
 (with-test (:name :ignore-delays
-            :fails-on :arm)
+            :fails-on (or :arm :loongarch64))
   (assert-type
    (lambda (x)
      (declare (optimize debug))
diff --git a/tests/debug.impure.lisp b/tests/debug.impure.lisp
index 805f85ba3..9fd4d64b2 100644
--- a/tests/debug.impure.lisp
+++ b/tests/debug.impure.lisp
@@ -955,7 +955,7 @@
 
 (with-test (:name (:debugger :list-locations)
             ;; there's an extra location on arm for some reason.
-            :fails-on :arm)
+            :fails-on (or :arm :loongarch64))
   (test-debugger
    "ll #'!
     debugger-test-done!"
@@ -1333,8 +1333,8 @@
           ;; properly tagged interior pointers. For those which do use LRAs,
           ;; there are at least that many, because we allow pointing to LRAs,
           ;; but they aren't enumerable so we don't know the actual count.
-          (assert (#+(or x86 x86-64 arm64 riscv) =
-                   #-(or x86 x86-64 arm64 riscv) >
+          (assert (#+(or x86 x86-64 arm64 riscv loongarch64) =
+                   #-(or x86 x86-64 arm64 riscv loongarch64) >
                      (loop for ptr from (+ base (* 2 sb-vm:n-word-bytes))
                            below limit count (properly-tagged-p ptr))
                      n))
diff --git a/tests/float.pure.lisp b/tests/float.pure.lisp
index 19dce9fc8..a18aeb7ae 100644
--- a/tests/float.pure.lisp
+++ b/tests/float.pure.lisp
@@ -191,7 +191,7 @@
                              (+ x0 x1 x6 x7) (+ x2 x3 x4 x5)))))))
 
 (with-test (:name (:nan :comparison)
-            :fails-on (or :sparc))
+            :fails-on (or :sparc :loongarch64))
   (sb-int:with-float-traps-masked (:invalid)
     (macrolet ((test (form)
                  (let ((nform (subst '(/ 0.0 0.0) 'nan form)))
@@ -238,7 +238,7 @@
       (test (not (> nan 1.0))))))
 
 (with-test (:name (:nan :comparison :non-float)
-            :fails-on (or :sparc))
+            :fails-on (or :sparc :loongarch64))
   (sb-int:with-float-traps-masked (:invalid)
     (let ((nan (/ 0.0 0.0))
           (reals (list 0 1 -1 1/2 -1/2 (expt 2 300) (- (expt 2 300))))
diff --git a/tests/foreign-stack-alignment.impure.lisp b/tests/foreign-stack-alignment.impure.lisp
index 1954ca5c9..063306afc 100644
--- a/tests/foreign-stack-alignment.impure.lisp
+++ b/tests/foreign-stack-alignment.impure.lisp
@@ -30,6 +30,7 @@
 (defvar *required-alignment*
   (or #+arm 8
       #+mips 8
+      #+loongarch64 8
       #+(and ppc darwin) 16
       #+(and ppc (not darwin)) 8
       #+(or arm64 x86 x86-64 riscv ppc64) 16
diff --git a/tests/gethash-concurrency.pure.lisp b/tests/gethash-concurrency.pure.lisp
index 1843b5335..997b97528 100644
--- a/tests/gethash-concurrency.pure.lisp
+++ b/tests/gethash-concurrency.pure.lisp
@@ -131,7 +131,8 @@
 
 (defparameter *sleep-delay-max* .025)
 
-(with-test (:name (hash-table :synchronized))
+(with-test (:name (hash-table :synchronized)
+		  :broken-on (or :loongarch64))
   (dolist (shrinkp '(nil t))
    (with-test-setup (keys (hash (make-hash-table :synchronized t)))
     (let* ((*errors* nil)
@@ -207,16 +208,18 @@
             (assert (not *errors*))))))))
 (compile 'test-concurrent-gethash)
 
-(with-test (:name (hash-table :parallel-readers-eq-table))
+(with-test (:name (hash-table :parallel-readers-eq-table)
+	    :broken-on (or :loongarch64))
   (test-concurrent-gethash 'eq))
 (with-test (:name (hash-table :parallel-readers-eql-table)
-            :broken-on (or :riscv)) ;; memory reordering issues
+            :broken-on (or :riscv :loongarch64)) ;; memory reordering issues
   (test-concurrent-gethash 'eql))
 (with-test (:name (hash-table :parallel-readers-equal-table)
-            :broken-on (or :riscv))
+            :broken-on (or :riscv :loongarch64))
   (test-concurrent-gethash 'equal))
 
-(with-test (:name (hash-table :single-accessor :parallel-gc))
+(with-test (:name (hash-table :single-accessor :parallel-gc)
+	    :broken-on (or :loongarch64))
   (dolist (shrinkp '(nil t))
     (with-test-setup (keys (hash (make-hash-table)))
       (let ((*errors* nil))
@@ -247,7 +250,8 @@
 
 ;;; Stress GROW-HASH-TABLE's optimization wherein no rehashing may be
 ;;; done if the index vector is not growing.
-(with-test (:name (hash-table :not-growing-index-vector :parallel-gc))
+(with-test (:name (hash-table :not-growing-index-vector :parallel-gc)
+	    :broken-on (or :loongarch64))
   (let ((*errors* nil))
     (let ((threads
             (list (make-kill-thread
diff --git a/tests/hash-table.impure.lisp b/tests/hash-table.impure.lisp
index cf9002391..317f8ffd5 100644
--- a/tests/hash-table.impure.lisp
+++ b/tests/hash-table.impure.lisp
@@ -225,7 +225,7 @@
     (with-locked-hash-table (h) (setf (gethash 'foo h) 1))))
 
 (with-test (:name :hash-table-iterator-no-notes
-                  :fails-on (:or :arm :ppc :ppc64))
+                  :fails-on (:or :arm :ppc :ppc64 :loongarch64))
   (let ((f
          (checked-compile
           '(lambda (h)
diff --git a/tests/make-thread.pure.lisp b/tests/make-thread.pure.lisp
index a43593bcb..71cf98bf6 100644
--- a/tests/make-thread.pure.lisp
+++ b/tests/make-thread.pure.lisp
@@ -64,12 +64,12 @@
                      (let ((obj (sb-vm::reconstitute-object (%make-lisp-obj baseptr))))
                        (when (code-component-p obj)
                          (cond
-                          #+(or c-stack-is-control-stack arm64 riscv)
+                          #+(or c-stack-is-control-stack arm64 riscv loongarch64)
                           ((= (logand word sb-vm:lowtag-mask) sb-vm:fun-pointer-lowtag)
                            (dotimes (i (code-n-entries obj))
                              (when (= (get-lisp-obj-address (%code-entry-point obj i)) word)
                                (return (setq obj (%code-entry-point obj i))))))
-                          #-(or c-stack-is-control-stack arm64 riscv) ; i.e. does this backend have LRAs
+                          #-(or c-stack-is-control-stack arm64 riscv loongarch64) ; i.e. does this backend have LRAs
                           ((= (logand (sb-sys:sap-ref-word (int-sap (logandc2 word sb-vm:lowtag-mask)) 0)
                                       sb-vm:widetag-mask) sb-vm:return-pc-widetag)
                            (setq obj (%make-lisp-obj word)))))
diff --git a/tests/step.pure.lisp b/tests/step.pure.lisp
index 0cfd2e5ea..d1542e8f6 100644
--- a/tests/step.pure.lisp
+++ b/tests/step.pure.lisp
@@ -12,7 +12,7 @@
 ;;;; more information.
 
 ;; No stepper support on some platforms.
-#+(or interpreter riscv) (invoke-restart 'run-tests::skip-file)
+#+(or interpreter riscv loongarch64) (invoke-restart 'run-tests::skip-file)
 
 ;; These tests should either with code in dynamic space
 ;; or immobile space, but they only accidentally worked
diff --git a/tests/threads.impure.lisp b/tests/threads.impure.lisp
index 977b61bf7..0d390906c 100644
--- a/tests/threads.impure.lisp
+++ b/tests/threads.impure.lisp
@@ -636,7 +636,7 @@
   (sb-ext:gc)
   (incf *n-gcs-done*))
 
-#+(or x86 x86-64 riscv) ;the only platforms with a *binding-stack-pointer* variable
+#+(or x86 x86-64 riscv loongarch64) ;the only platforms with a *binding-stack-pointer* variable
 (defun exercise-binding ()
   (loop
    (let ((*x* (make-something-big)))
@@ -656,7 +656,7 @@
      (wait-for-gc)
      (decf sb-vm::*binding-stack-pointer* binding-pointer-delta))))
 
-#+(or x86 x86-64 riscv) ;the only platforms with a *binding-stack-pointer* variable
+#+(or x86 x86-64 riscv loongarch64) ;the only platforms with a *binding-stack-pointer* variable
 (with-test (:name (:binding-stack-gc-safety)
             :broken-on :win32)
   (let (threads)
-- 
2.20.1
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.