Implements svex-argmasks for
(svmask-for-bitand mask args) → argmasks
We are considering a
For any particular bit of
Well, almost. What if we know that bit 4 of
We don't currently try very hard to make any kind of sensible choice here.
Instead, as a rather arbitrary default, we normally mask
Function:
(defun svmask-for-bitand (mask args) (declare (xargs :guard (and (4vmask-p mask) (svexlist-p args)))) (let ((__function__ 'svmask-for-bitand)) (declare (ignorable __function__)) (b* (((svex-nths x y) args) (mask (4vmask-fix mask))) (b* (((s4vec xval) (svex-s4xeval x)) ((s4vec yval) (svex-s4xeval y)) (x-zero (sparseint-bitnor xval.upper xval.lower)) (y-zero (sparseint-bitnor yval.upper yval.lower)) (shared-zeros (sparseint-bitand x-zero (sparseint-bitand y-zero mask))) (xm-nonzero (sparseint-bitandc2 mask x-zero)) (ym-nonzero (sparseint-bitandc2 mask y-zero)) ((when (sparseint-equal 0 shared-zeros)) (list ym-nonzero xm-nonzero)) (y-x (sparseint-bitandc2 yval.upper yval.lower)) (ym-x (sparseint-test-bitand mask y-x)) ((unless ym-x) (list ym-nonzero (sparseint-bitor xm-nonzero shared-zeros)))) (list (sparseint-bitor ym-nonzero shared-zeros) xm-nonzero)))))
Theorem:
(defthm 4vmasklist-p-of-svmask-for-bitand (b* ((argmasks (svmask-for-bitand mask args))) (4vmasklist-p argmasks)) :rule-classes :rewrite)
Theorem:
(defthm svmask-for-bitand-of-4vmask-fix-mask (equal (svmask-for-bitand (4vmask-fix mask) args) (svmask-for-bitand mask args)))
Theorem:
(defthm svmask-for-bitand-4vmask-equiv-congruence-on-mask (implies (4vmask-equiv mask mask-equiv) (equal (svmask-for-bitand mask args) (svmask-for-bitand mask-equiv args))) :rule-classes :congruence)
Theorem:
(defthm svmask-for-bitand-of-svexlist-fix-args (equal (svmask-for-bitand mask (svexlist-fix args)) (svmask-for-bitand mask args)))
Theorem:
(defthm svmask-for-bitand-svexlist-equiv-congruence-on-args (implies (svexlist-equiv args args-equiv) (equal (svmask-for-bitand mask args) (svmask-for-bitand mask args-equiv))) :rule-classes :congruence)
Theorem:
(defthm svmask-for-bitand-correct (implies (and (equal (4veclist-mask (svmask-for-bitand mask args) (svexlist-eval args env)) (4veclist-mask (svmask-for-bitand mask args) args1)) (syntaxp (not (equal args1 (cons 'svexlist-eval (cons args (cons env 'nil))))))) (equal (4vec-mask mask (svex-apply 'bitand args1)) (4vec-mask mask (svex-apply 'bitand (svexlist-eval args env))))))