Access the |X86ISA|::|REG| field of a modr/m bit structure.
Function:
(defun modr/m->reg$inline (x) (declare (xargs :guard (modr/m-p x))) (mbe :logic (let ((x (modr/m-fix x))) (part-select x :low 3 :width 3)) :exec (the (unsigned-byte 3) (logand (the (unsigned-byte 3) 7) (the (unsigned-byte 5) (ash (the (unsigned-byte 8) x) -3))))))
Theorem:
(defthm 3bits-p-of-modr/m->reg (b* ((reg (modr/m->reg$inline x))) (3bits-p reg)) :rule-classes :rewrite)
Theorem:
(defthm modr/m->reg$inline-of-modr/m-fix-x (equal (modr/m->reg$inline (modr/m-fix x)) (modr/m->reg$inline x)))
Theorem:
(defthm modr/m->reg$inline-modr/m-equiv-congruence-on-x (implies (modr/m-equiv x x-equiv) (equal (modr/m->reg$inline x) (modr/m->reg$inline x-equiv))) :rule-classes :congruence)
Theorem:
(defthm modr/m->reg-of-modr/m (equal (modr/m->reg (modr/m r/m reg mod)) (3bits-fix reg)))
Theorem:
(defthm modr/m->reg-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) 56) 0)) (equal (modr/m->reg x) (modr/m->reg y))))