fix(sb-simd): define missing-instruction fallbacks for sap-ref on unsupported CPUs

- In define-vrefs.lisp, emit define-missing-instruction forms for ,sap
  and (setf ,sap) when the target instruction set is not available.
  Prevents unattached definition errors during package validation
  (e.g. F64.8-SAP-REF on hosts without AVX-512 support).
- In missing-instruction.lisp, use record-instruction-set and
  record-name rather than instruction-record-* aliases so that
  missing-instruction error reporting works for sap-ref and other
  function records inheriting from base record.
- Verified under Intel SDE Haswell (-hsw) and Skylake (-skl) emulation
  with 0 errors (737 tests, 9,992,078 checks passed).
- Verified natively on Zen 4 host with 0 regressions (737 tests,
  13,860,908 checks passed).
This commit is contained in:
Aaron Estrada 2026-09-08 06:56:59 -06:00 committed by Stas Boukarev
parent 336b6ae146
commit ed317dc00c
3 changed files with 16 additions and 8 deletions

View file

@ -18,8 +18,12 @@
(ecase kind (ecase kind
(:load (:load
(if (not (instruction-set-available-p instruction-set)) (if (not (instruction-set-available-p instruction-set))
`(define-missing-instruction ,name `(progn
:required-arguments (array index)) (define-missing-instruction ,name
:required-arguments (array index))
,@(when sap
`((define-missing-instruction ,sap
:required-arguments (sap index)))))
`(progn `(progn
(define-inline ,name (array index) (define-inline ,name (array index)
(declare (type (array ,element-type) array) (declare (type (array ,element-type) array)
@ -35,8 +39,12 @@
(,sap-vop sap index 0))))))) (,sap-vop sap index 0)))))))
(:store (:store
(if (not (instruction-set-available-p instruction-set)) (if (not (instruction-set-available-p instruction-set))
`(define-missing-instruction ,name `(progn
:required-arguments (value array index)) (define-missing-instruction ,name
:required-arguments (value array index))
,@(when sap
`((define-missing-instruction (setf ,sap)
:required-arguments (value sap index)))))
`(progn `(progn
(define-inline ,name (value array index) (define-inline ,name (value array index)
(declare (type (array ,element-type) array) (declare (type (array ,element-type) array)

View file

@ -11,8 +11,8 @@
:reader missing-instruction-record)) :reader missing-instruction-record))
(:report (:report
(lambda (c s) (lambda (c s)
(with-accessors ((instruction-set instruction-record-instruction-set) (with-accessors ((instruction-set record-instruction-set)
(instruction-name instruction-record-name)) (instruction-name record-name))
(missing-instruction-record c) (missing-instruction-record c)
(format s "Missing ~S instruction ~S." (format s "Missing ~S instruction ~S."
(instruction-set-name instruction-set) (instruction-set-name instruction-set)

View file

@ -438,8 +438,8 @@
(#x0F #b001) (#x0F #b001)
(#x0F38 #b010) (#x0F38 #b010)
(#x0F3A #b011) (#x0F3A #b011)
((:map5 5 #x5) #b101) ((:map5 5) #b101)
((:map6 6 #x6) #b110)))) ((:map6 6) #b110))))
(defun emit-two-byte-vex (segment r vvvv l pp) (defun emit-two-byte-vex (segment r vvvv l pp)
(emit-bytes segment (emit-bytes segment