Commit graph

28829 commits

Author SHA1 Message Date
Stas Boukarev 188ae65ab5 Fix avx-512 register allocation
Don't assign zmm0-15 first and run out of registers for xmm/ymm.
Assign zmm31-0 instead.
2026-08-26 01:55:19 +03:00
Stas Boukarev 19040616e7 Fix %make-simd-pack-512-single
Don't overwrite the inputs before they are used.
2026-08-26 01:15:57 +03:00
Stas Boukarev d876820656 arm64: fix %make-simd-pack-double/single
Don't overwrite the inputs before they are used.
2026-08-26 00:51:13 +03:00
Stas Boukarev 856ed453f3 Stop touching avx512 registers in c-call
Which forces avx512 instructions to be used.
This breaks avx512 spilling around foreign calls.

Fixes lp#2164994
2026-08-25 17:23:53 +03:00
Stas Boukarev d21baee184 Add an assertion 2026-08-25 04:09:03 +03:00
Stas Boukarev 6fcc8d928b Correctly signal encoding errors from string-to-octets
Fixes lp#2164924
2026-08-24 20:42:27 +03:00
Stas Boukarev ff86fee2c0 avx2/utf8-strlen: fix the 1/2 byte fast path
Which omits overlongs coming from the full path.
2026-08-24 03:52:04 +03:00
Stas Boukarev c104c75a3c Remove defknowns for removed functions 2026-08-24 03:52:04 +03:00
Stas Boukarev 6a371bf547 Add a folder stub for reverse-values-list
Reported by Andrew Wolven
2026-08-24 02:07:29 +03:00
Stas Boukarev 0d87331ec9 Improve utf-8 tests 2026-08-24 01:31:50 +03:00
Douglas Katzman 0f6128e4a6 Augment genesis/number-types.h, don't make more headers 2026-08-22 13:53:16 -04:00
Douglas Katzman 0383982d88 x86-64: Permute Lisp arg-passing registers
Lisp and C are new identical for #+unix though not #+win32

Co-authored by Gemini
2026-08-22 13:02:13 -04:00
Stas Boukarev bd76fc4481 arm64/character-string-to-utf8: jump to ascii-loop from a better place 2026-08-22 17:31:35 +03:00
Douglas Katzman 0eb8b556ac Apply various micro-optimizations to VECTOR-FILL/T
* use a loopless final pass after the unrolled pass
* use one fewer temp register
* remove a couple of instructions here and there

Also some stylistic changes:
* give better names to registers depending on their usage
* avoid an #ifdef for SB_SAFEPOINT in x86-64-arch

Co-authored with Gemini
2026-08-22 02:00:51 +00:00
Stas Boukarev e4a5665070 arm64/character-string-to-utf8: escape back to ascii-loop 2026-08-22 04:35:51 +03:00
Stas Boukarev bded621c00 arm64/character-string-to-utf8: add a fast-path for 1-2 bytes 2026-08-22 03:21:22 +03:00
Stas Boukarev ca69a527f0 Move an instruction. 2026-08-22 01:37:57 +03:00
Douglas Katzman b5c1bfad94 Make EMIT-EA more complicated
because it wasn't bad^H^H^Hflexible enough
2026-08-21 22:35:29 +00:00
Douglas Katzman 18f8a0c8ea build-all-cores 2026-08-21 22:19:29 +00:00
Stas Boukarev 023755eb0c Incomplete previous diff 2026-08-21 22:22:11 +03:00
Stas Boukarev 2cce59959a x86-64-simd: use helper functions throughout 2026-08-21 21:38:10 +03:00
Stas Boukarev 29b5b1674d Remove non-ascii characters from sources
[skip ci]
2026-08-21 19:18:41 +03:00
arthur f7fe8b09df add infrastructure for EVEX compressed displacement
* Add dstate-disp-n to disassem-state
* Add reg/mem arg types for tuple sizes 1,2,4,8,16,32,64.
* Extend avx512-inst-printer-list to accept :disp-n.
* Scale EVEX disp8 by the instruction-specific tuple size in decode-mod-r/m
* Annotate full-vector EVEX moves and emit compressed displacement for them.
* Add disassembler tests for the functionality in this patch

This covers the full-vector move subset. For other EVEX memory
instructions more work is needed.
2026-08-21 18:48:06 +03:00
arthur e2ff58b302 EVEX: add V' and improve 5-bit register decoding
* Add +evex+ indicator to distinguish EVEX from VEX/legacy
  even for EVEX L'L=00 forms
* Decode ModRM.reg registers 16–31 using R'
* Stop incorrectly applying R' to ModRM.r/m operands
* Decode EVEX ModRM.r/m register-direct 16–31 using X as B'
* Decode EVEX vvvv registers 16–31 using V'
2026-08-21 18:17:34 +03:00
Stas Boukarev 82ffc78960 avx2/utf8-to-character-string: add a 1/2-byte fast path 2026-08-21 02:15:56 +03:00
arthur fde3ddff06 x86-64: rename xmm-tn-p to float-tn-p 2026-08-20 20:42:26 +03:00
Stas Boukarev 6d159d1fd9 (- a (- a b)) => b
And friends.
2026-08-20 15:51:10 +03:00
Stas Boukarev 2e8fa20cbd decode-universal-time: don't do mod and truncate separately
And some other arithmetic rearrangements.
2026-08-20 14:02:17 +03:00
Stas Boukarev 23dedf9150 Copying error 2026-08-20 12:07:57 +03:00
Stas Boukarev fc1d28224a Remove mappings from float-regs to offsets
They are just sequential integers.
2026-08-20 12:01:55 +03:00
arthur c3bb5b8700 Basic support for AVX512 mask registers
* add simd-pack-512-mask as intrinsic type (widetag)
* add associated book-keeping in VM, compiler and interpreter for simd-pack-512-mask
* add VM support for mask registers (mask-reg SC, SB, defregs, ...)
* add VOPs to compiler backend for construction, extraction
* add VOPs for movement: kregs<->kregs, kregs<->gpr and kregs<->mem
* add support for assembler in insts, avx2-insts and avx512-insts
* rewrite most of evex emitter regarding mask registers
* add print support in evex for mask related instructions
* fix some smaller bugs in previous simd-pack-512 support patch
* add tests for creation, extraction, movements, assembly printing and some internal functions
* refactor zmm-registers-used-p into avx512-state-used-p and update call sites
* add support for mask regs to avx512-state-used-p
2026-08-20 10:55:19 +03:00
Stas Boukarev 49beef5fe4 clos.impure passes on sb-eval too 2026-08-20 10:55:19 +03:00
Douglas Katzman f797952a84 Preemptively adjust a test
If RDX ceases to be the first arg-passing register, then this test will fail
because there is no byte-sized register corresponding to byte index 1 of RDI.
2026-08-20 03:52:53 +00:00
Douglas Katzman 5ca456d7fe x86[-64]: Invent syntactic convenience in define-assembly-routine
I want to permute the 3 lisp arg-passing registers to match the machine ABI
and this change makes it less ugly to do so. (Some DEFINE-ALIEN-ROUTINEs
in user code and SBCL itself could potentially emit fewer moves by matching
the ABI but we also will want to tackle a problem of needless spill/restore
of register args by eliminating dead stores)

Other backends don't strictly benefit from this syntax because register
names such as A0,A1 already express exactly what they mean to, whereas x86
register names are alphabet soup in comparison.
2026-08-19 17:01:32 -04:00
Douglas Katzman f5e063c351 Remove #+#. from x86-64 files
We can safely assume n-fixnum-tag-bits = 1. Revision a369686d which gave 1 more
bit of precision theorized that a build-time choice could be made within a
particular backend. While that was true for a while after the commit, x86-64
is now so ingrained with the belief that fixnums are 63 bits that it can't
reasonably be changed. While we should prefer the symbolic constant in lieu
of a literal 1, that style does not imply that littering up the source with
illegible "#+#.(cl:if)" around vops that can't be enabled is sound practice.
2026-08-19 14:15:56 -04:00
Douglas Katzman a3dbf9924e Prefer not to use #+#. in tests 2026-08-19 13:25:20 -04:00
Douglas Katzman f4dc30318b Enable most of clos.impure for --evaluator-mode interpret
Was disabled by rev 278038f2bb but seems to pass nearly all tests
under sb-fasteval. No idea what the situation is with sb-eval.
2026-08-19 13:20:31 -04:00
Stas Boukarev 945dba8de3 read-line: faster return if #\Newline is in the buffer 2026-08-19 08:01:34 +03:00
Stas Boukarev 0b019f26d4 arm64/utf8-to-string: return to the fast path from the full loop
The check is performed for free by utilizing the integer pipeline
using SWAR.
2026-08-19 05:02:42 +03:00
Stas Boukarev b3a61535ef Rearrange branches 2026-08-19 02:04:40 +03:00
Stas Boukarev adb9b23144 arm64/utf8-sap-to-character-string: add a 1/2-byte fast path 2026-08-19 01:54:38 +03:00
Stas Boukarev 4b2be60c8b Don't stop compilation on bad type declarations 2026-08-18 07:41:05 +03:00
Stas Boukarev 09e5b5d14e Never transform ELT to NTH
The initial problem is that elt derives types on constant lists
without adding a NIL, which can be returned by NTH.
Always check bounds instead.
There's no performance advantage in not signaling an error.
2026-08-18 06:44:02 +03:00
Douglas Katzman 8a26a86d76 Assign layout-ids just-in-time as originally intended
This wasn't working right, and the assertion in LAYOUT-ID about assigning
only structures an ID was written incorrectly.

* Layout IDs are assigned only when applying a :layout-id fixup or when storing
  into a descendant type's ID array, whichever occurs first.
* IDs of non-structure instances like STREAM that have nonzero IDs are
  stored at the correct place for their depthoid, and not always at index 0
  so that LAYOUT-ID doesn't have to test +structure-layout-flag+.
* LAYOUT-ID returns NIL instead of 0 if no ID is assigned.
  machine-dependent files will never see the 0.
* The remark that IDs could do type-based dispatch is no longer hypothetical
2026-08-17 19:15:29 -04:00
Stas Boukarev 06151ad1c1 Fix ldb transforms
erase-node-type has to be called with value-types.

Reported by Eric Marsden.
2026-08-17 18:23:13 +03:00
Stas Boukarev 0a1f43ff5d Replace two instructions with one 2026-08-17 07:19:16 +03:00
Stas Boukarev 7f3f7b8ef3 Use a smaller instruction 2026-08-17 06:21:00 +03:00
Douglas Katzman 4f0efb07bc Fix typo 2026-08-17 02:55:35 +00:00
Douglas Katzman b3b9f0efa2 Factor out boilerplate from structure-is-a 2026-08-16 22:19:14 -04:00
Stas Boukarev 65b968f2ac avx2/character-string-to-utf8: optimize newline tracking
And ASCII detection.
Let it work on the bytes packed with saturation.
Use branches.
2026-08-17 04:02:49 +03:00