Update the |X86ISA|::|REG| field of a modr/m bit structure.
Function:
(defun !modr/m->reg$inline (reg x) (declare (xargs :guard (and (3bits-p reg) (modr/m-p x)))) (mbe :logic (b* ((reg (mbe :logic (3bits-fix reg) :exec reg)) (x (modr/m-fix x))) (part-install reg x :width 3 :low 3)) :exec (the (unsigned-byte 8) (logior (the (unsigned-byte 8) (logand (the (unsigned-byte 8) x) (the (signed-byte 7) -57))) (the (unsigned-byte 6) (ash (the (unsigned-byte 3) reg) 3))))))
Theorem:
(defthm modr/m-p-of-!modr/m->reg (b* ((new-x (!modr/m->reg$inline reg x))) (modr/m-p new-x)) :rule-classes :rewrite)
Theorem:
(defthm !modr/m->reg$inline-of-3bits-fix-reg (equal (!modr/m->reg$inline (3bits-fix reg) x) (!modr/m->reg$inline reg x)))
Theorem:
(defthm !modr/m->reg$inline-3bits-equiv-congruence-on-reg (implies (3bits-equiv reg reg-equiv) (equal (!modr/m->reg$inline reg x) (!modr/m->reg$inline reg-equiv x))) :rule-classes :congruence)
Theorem:
(defthm !modr/m->reg$inline-of-modr/m-fix-x (equal (!modr/m->reg$inline reg (modr/m-fix x)) (!modr/m->reg$inline reg 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 reg x) (!modr/m->reg$inline reg x-equiv))) :rule-classes :congruence)
Theorem:
(defthm !modr/m->reg-is-modr/m (equal (!modr/m->reg reg x) (change-modr/m x :reg reg)))
Theorem:
(defthm modr/m->reg-of-!modr/m->reg (b* ((?new-x (!modr/m->reg$inline reg x))) (equal (modr/m->reg new-x) (3bits-fix reg))))
Theorem:
(defthm !modr/m->reg-equiv-under-mask (b* ((?new-x (!modr/m->reg$inline reg x))) (modr/m-equiv-under-mask new-x x -57)))