Re: Adapt sb-simd to read from SAPs

Sylvia Harrington <[email protected]> Sun, 2 Aug 2026 14:25:12 +0100
Newsgroups gmane.lisp.steel-bank.devel
Message-ID <[email protected]>
--Apple-Mail=_C523497D-6B67-4B4D-81EA-6326E8B91914
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8

Here=E2=80=99s a patch to implement the sap stuff on arm64. Should apply =
on top of 6f4d258f3 "Support for load/stor to and from SAPs=E2=80=9D.

Not tested but builds fine on my machine. I=E2=80=99ve eyeballed the =
disassembly and it looks right.


--Apple-Mail=_C523497D-6B67-4B4D-81EA-6326E8B91914
Content-Disposition: attachment;
	filename=0001-sb-simd-Implement-vector-sap-ref-for-arm64.patch
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="0001-sb-simd-Implement-vector-sap-ref-for-arm64.patch"
Content-Transfer-Encoding: quoted-printable

=46rom=20544744c68f653080b6bf9279fd3fd35ac3e801ed=20Mon=20Sep=2017=20=
00:00:00=202001=0AFrom:=20Sylvia=20Harrington=20=
<[email protected]>=0ADate:=20Sun,=202=20Aug=202026=20=
14:22:11=20+0100=0ASubject:=20[PATCH]=20sb-simd:=20Implement=20vector=20=
sap-ref=20for=20arm64=0A=0A---=0A=20=
contrib/sb-simd/code/define-vref-vops.lisp=20|=2036=20=
+++++++++++++++++++---=0A=201=20file=20changed,=2031=20insertions(+),=20=
5=20deletions(-)=0A=0Adiff=20--git=20=
a/contrib/sb-simd/code/define-vref-vops.lisp=20=
b/contrib/sb-simd/code/define-vref-vops.lisp=0Aindex=20=
80219914c..6ace1d968=20100644=0A---=20=
a/contrib/sb-simd/code/define-vref-vops.lisp=0A+++=20=
b/contrib/sb-simd/code/define-vref-vops.lisp=0A@@=20-145,11=20+145,10=20=
@@=0A=20=20=20=20=20((define-vref-vop=20(vref-record-name)=0A=20=20=20=20=
=20=20=20=20(with-accessors=20((name=20=
sb-simd-internals:vref-record-name)=0A=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20(vop=20=
sb-simd-internals:vref-record-vop)=0A-=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20(vop-c=20=
sb-simd-internals:vref-record-vop-c)=0A-=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20(mnemonic=20=
sb-simd-internals:vref-record-mnemonic)=0A=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20(value-record=20=
sb-simd-internals:vref-record-value-record)=0A=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(vector-record=20=
sb-simd-internals:vref-record-vector-record)=0A-=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(store=20=
sb-simd-internals:store-record-p))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20(store=20=
sb-simd-internals:store-record-p)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20(sap-ref=20=
sb-simd-internals:vref-record-sap-ref))=0A=20=20=20=20=20=20=20=20=20=20=20=
=20(sb-simd-internals:find-function-record=20vref-record-name)=0A=20=20=20=
=20=20=20=20=20=20=20(let*=20((vector-type=20=
(sb-simd-internals:value-record-type=20vector-record))=0A=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20(vector-primitive-type=20=
(sb-simd-internals:value-record-primitive-type=20vector-record))=0A@@=20=
-162,7=20+161,9=20@@=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20(sb-simd-internals:value-record=20value-record)))=0A=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20(bits-per-element=20=
(sb-simd-internals:value-record-bits=20scalar-record))=0A=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20(bytes-per-element=20(ceiling=20=
bits-per-element=208))=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
(shift=20(1-=20(integer-length=20bytes-per-element))))=0A+=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20(shift=20(1-=20(integer-length=20=
bytes-per-element)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
(sap-vop=20(when=20sap-ref=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20(sb-simd-internals:mksym=20=
(symbol-package=20name)=20(if=20store=20"%SET-"=20"%")=20sap-ref))))=0A=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20`(progn=0A=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20(defknown=20,vop=20(,@(when=20store=20=
`(,value-type))=20,vector-type=20index=20(integer=200=200))=0A=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(values=20,value-type=20=
&optional)=0A@@=20-203,7=20+204,32=20@@=0A=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(inst=20,(if=20store=20'str=20=
'ldr)=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20value=0A=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(@=20tmp-tn=20=
(load-store-offset=20(-=20(ash=20vector-data-offset=20word-shift)=0A-=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20other-pointer-lowtag)))))))))))))=0A+=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20other-pointer-lowtag)))))))))=0A+=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20,@(when=20sap-vop=0A+=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20`((sb-c:defknown=20,sap-vop=20=
(,@(when=20store=20`(,value-type))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20sb-sys:system-area-pointer=20index=20(integer=20=
0=200))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20(values=20,value-type=20&optional)=0A+=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(always-translatable)=0A+=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
:overwrite-fndb-silently=20t)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20(define-vop=20(,sap-vop)=0A+=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20(:translate=20,sap-vop)=0A+=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(:policy=20=
:fast-safe)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20(:args=20,@(when=20store=20`((value=20:scs=20(,@value-scs=20=
zero))))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20(sap=20:scs=20(sap-reg))=0A+=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
(offset=20:scs=20(signed-reg)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20(:info=20addend)=0A+=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20(:arg-types=20,@(when=20store=20=
`(,value-primitive-type))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
system-area-pointer=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20signed-num=0A+=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20(:constant=20(integer=200=200)))=0A+=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20,@(unless=20store=0A+=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
`((:results=20(value=20:scs=20,value-scs))=0A+=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(:result-types=20=
,value-primitive-type)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20(:generator=201=0A+=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20(let=20((addend=20addend))=0A+=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
(declare=20(ignore=20addend))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20(inst=20,(if=20store=20'str=20'ldr)=20=
value=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20(@=20sap=20offset)))))))))))=0A=20=20=20=20=20=
=20(define-vref-vops=20()=0A=20=20=20=20=20=20=20=20`(progn=0A=20=20=20=20=
=20=20=20=20=20=20=20,@(loop=20for=20vref-record=0A--=20=0A2.50.1=20=
(Apple=20Git-155)=0A=0A=

--Apple-Mail=_C523497D-6B67-4B4D-81EA-6326E8B91914
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8



> On 1 Aug 2026, at 15:13, Stas Boukarev <[email protected]> wrote:
>=20
> If you can make it just do nothing for arm64 that would also be fine.
>=20
> On Sat, Aug 1, 2026 at 4:03=E2=80=AFPM arthur miller =
<[email protected]> wrote:
>>=20
>>=20
>>> I think you need to enable it first.
>>=20
>> Ok, I have managed to enable actions, and to uploade my sap worktree:
>>=20
>> https://github.com/amno1/sbcl/tree/sb-simd-sap
>>=20
>> Unfortunately, I will have to dissapoint you, I can't do that one. I
>> have never done anything on arm cpu, so I really have no idea what I =
am
>> doing there. The interesting file is:
>>=20
>> =
https://github.com/amno1/sbcl/blob/sb-simd-sap/contrib/sb-simd/code/define=
-vref-vops.lisp
>>=20
>> The job is to calculate the EA from just SAP (base pointer) and =
without
>> array header. On x86 SBCL uses sap-reg as storage class for =
manipulating
>> SAPs in registers, I guess it would be the case on arm too, but I am
>> just guessing there. I was hoping when given the correct address,
>> generic load/store vops would take care of the rest, but it fails.
>>=20
>> Interestingly enough, it pass on linux arm, and qemu 64, but not on
>> linux arm64.
>>=20
>> If you can fix it, it would be nice. Otherwise if no one is =
interesting
>> about it, than I'll guess it will have to wait for better days :).
>=20
>=20
> _______________________________________________
> Sbcl-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sbcl-devel


--Apple-Mail=_C523497D-6B67-4B4D-81EA-6326E8B91914
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--Apple-Mail=_C523497D-6B67-4B4D-81EA-6326E8B91914
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

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

--Apple-Mail=_C523497D-6B67-4B4D-81EA-6326E8B91914--