Re: [Sbcl-bugs] [PATCH] riscv: add missing zero extension for unsigned 32-bit cas sap-ref

Stas Boukarev <[email protected]> Tue, 24 Feb 2026 18:11:33 +0300
Newsgroups gmane.lisp.steel-bank.devel
Message-ID <CAF63=10cDQ8w7KGaLAGT0Vcq5kx0-QRedUNn3=_Q2uKr2_GAPQ@mail.gmail.com>
Applied. Thanks

On Tue, Feb 24, 2026 at 4:39 PM Andreas Schwab <[email protected]> wrote:
>
> ---
>  src/compiler/riscv/sap.lisp        | 3 +++
>  tests/compare-and-swap.impure.lisp | 2 +-
>  2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/src/compiler/riscv/sap.lisp b/src/compiler/riscv/sap.lisp
> index 480324cc6..7758ebaff 100644
> --- a/src/compiler/riscv/sap.lisp
> +++ b/src/compiler/riscv/sap.lisp
> @@ -203,6 +203,9 @@
>                             (inst add addr sap offset)
>                             LOOP
>                             (inst ,load result addr :aq)
> +                           #+64-bit ,@(when (and (not signed) (eq size :word))
> +                                        `((inst slli result result 32)
> +                                          (inst srli result result 32)))
>                             (inst bne result oldval EXIT)
>                             (inst ,store temp newval addr :aq :rl)
>                             (inst bne temp zero-tn LOOP)
> diff --git a/tests/compare-and-swap.impure.lisp b/tests/compare-and-swap.impure.lisp
> index c6af87ae8..3b8d59566 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 (or :riscv :loongarch64) ; unsigned-32-bit gets the wrong answer
> +                            :fails-on :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)
> --
> 2.53.0
>
>
> --
> Andreas Schwab, SUSE Labs, [email protected]
> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
> "And now for something completely different."
>
>
> _______________________________________________
> Sbcl-bugs mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sbcl-bugs


_______________________________________________
Sbcl-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sbcl-devel