Reduce a constant 4vec using a 4vmask; any irrelevant bits become 0s.
Function:
(defun 4vec-mask-to-zero (mask value) (declare (xargs :guard (and (4vmask-p mask) (4vec-p value)))) (let ((__function__ '4vec-mask-to-zero)) (declare (ignorable __function__)) (b* ((mask (sparseint-val (4vmask-fix mask))) ((4vec value) value)) (4vec (logand mask value.upper) (logand mask value.lower)))))
Theorem:
(defthm 4vec-p-of-4vec-mask-to-zero (b* ((masked-value (4vec-mask-to-zero mask value))) (4vec-p masked-value)) :rule-classes :rewrite)
Theorem:
(defthm 4vec-mask-to-zero-of-4vmask-fix-mask (equal (4vec-mask-to-zero (4vmask-fix mask) value) (4vec-mask-to-zero mask value)))
Theorem:
(defthm 4vec-mask-to-zero-4vmask-equiv-congruence-on-mask (implies (4vmask-equiv mask mask-equiv) (equal (4vec-mask-to-zero mask value) (4vec-mask-to-zero mask-equiv value))) :rule-classes :congruence)
Theorem:
(defthm 4vec-mask-to-zero-of-4vec-fix-value (equal (4vec-mask-to-zero mask (4vec-fix value)) (4vec-mask-to-zero mask value)))
Theorem:
(defthm 4vec-mask-to-zero-4vec-equiv-congruence-on-value (implies (4vec-equiv value value-equiv) (equal (4vec-mask-to-zero mask value) (4vec-mask-to-zero mask value-equiv))) :rule-classes :congruence)
Theorem:
(defthm 4vec-mask-to-zero-idempotent (equal (4vec-mask-to-zero mask (4vec-mask-to-zero mask value)) (4vec-mask-to-zero mask value)))
Theorem:
(defthm 4vec-mask-to-zero-minus-1 (equal (4vec-mask-to-zero -1 value) (4vec-fix value)))
Theorem:
(defthm 4vec-mask-to-zero-zero (equal (4vec-mask-to-zero 0 value) 0))
Theorem:
(defthm 4vec-mask-of-4vec-mask-to-zero (equal (4vec-mask mask (4vec-mask-to-zero mask value)) (4vec-mask mask value)))