Specification for the SIMD subtraction instructions.
(simd-sub-spec total-size chunk-size x y) → result
This is for the (V)PSUBB/(V)PSUBW/(V)PSUBD/(V)PSUBQ instructions.
Given
The
Function:
(defun simd-sub-spec (total-size chunk-size x y) (declare (xargs :guard (and (natp total-size) (posp chunk-size) (unsigned-byte-p total-size x) (unsigned-byte-p total-size y)))) (declare (xargs :guard (integerp (/ total-size chunk-size)))) (let ((__function__ 'simd-sub-spec)) (declare (ignorable __function__)) (b* (((when (zp total-size)) 0) ((unless (mbt (posp chunk-size))) 0) (x-lo (loghead chunk-size x)) (y-lo (loghead chunk-size y)) (result-lo (loghead chunk-size (- x-lo y-lo))) (x-hi (logtail chunk-size x)) (y-hi (logtail chunk-size y)) (result-hi (simd-sub-spec (- total-size chunk-size) chunk-size x-hi y-hi))) (logapp chunk-size result-lo result-hi))))
Theorem:
(defthm return-type-of-simd-sub-spec (implies (and (natp total-size) (posp chunk-size) (unsigned-byte-p total-size x) (unsigned-byte-p total-size y) (integerp (binary-* total-size (unary-/ chunk-size)))) (b* ((result (simd-sub-spec total-size chunk-size x y))) (unsigned-byte-p total-size result))) :rule-classes :rewrite)