Access the |COMMON-LISP|::|MOD| field of a modr/m bit structure.
Function:
(defun modr/m->mod$inline (x) (declare (xargs :guard (modr/m-p x))) (mbe :logic (let ((x (modr/m-fix x))) (part-select x :low 6 :width 2)) :exec (the (unsigned-byte 2) (logand (the (unsigned-byte 2) 3) (the (unsigned-byte 2) (ash (the (unsigned-byte 8) x) -6))))))
Theorem:
(defthm 2bits-p-of-modr/m->mod (b* ((mod (modr/m->mod$inline x))) (2bits-p mod)) :rule-classes :rewrite)
Theorem:
(defthm modr/m->mod$inline-of-modr/m-fix-x (equal (modr/m->mod$inline (modr/m-fix x)) (modr/m->mod$inline x)))
Theorem:
(defthm modr/m->mod$inline-modr/m-equiv-congruence-on-x (implies (modr/m-equiv x x-equiv) (equal (modr/m->mod$inline x) (modr/m->mod$inline x-equiv))) :rule-classes :congruence)
Theorem:
(defthm modr/m->mod-of-modr/m (equal (modr/m->mod (modr/m r/m reg mod)) (2bits-fix mod)))
Theorem:
(defthm modr/m->mod-of-write-with-mask (implies (and (fty::bitstruct-read-over-write-hyps x modr/m-equiv-under-mask) (modr/m-equiv-under-mask x y fty::mask) (equal (logand (lognot fty::mask) 192) 0)) (equal (modr/m->mod x) (modr/m->mod y))))