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