mirror of
git://git.code.sf.net/p/sbcl/sbcl
synced 2026-09-10 07:26:40 -04:00
- 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).
36 lines
1.3 KiB
Common Lisp
36 lines
1.3 KiB
Common Lisp
(in-package #:sb-simd-internals)
|
|
|
|
;;; Our library always defines all instruction sets and instructions, but
|
|
;;; usually, only a subset of them are actually available. All the
|
|
;;; remaining instructions are replaced by functions that signal a suitable
|
|
;;; error message.
|
|
|
|
(define-condition missing-instruction (error)
|
|
((%record
|
|
:initarg :record
|
|
:reader missing-instruction-record))
|
|
(:report
|
|
(lambda (c s)
|
|
(with-accessors ((instruction-set record-instruction-set)
|
|
(instruction-name record-name))
|
|
(missing-instruction-record c)
|
|
(format s "Missing ~S instruction ~S."
|
|
(instruction-set-name instruction-set)
|
|
instruction-name)))))
|
|
|
|
(defun missing-instruction (instruction-record)
|
|
(error 'missing-instruction :record instruction-record))
|
|
|
|
(defmacro define-missing-instruction
|
|
(name &key (required-arguments '()) (optional-arguments '()) (rest-argument nil))
|
|
(assert (find-function-record name))
|
|
`(defun ,name (,@required-arguments
|
|
,@optional-arguments
|
|
,@(when rest-argument `(&rest ,rest-argument)))
|
|
(declare (ignore ,@required-arguments
|
|
,@optional-arguments
|
|
,@(when rest-argument `(,rest-argument))))
|
|
(missing-instruction
|
|
(load-time-value
|
|
(find-function-record ',name)))))
|