Update the |X86ISA|::|SCALE| field of a sib bit structure.
Function:
(defun !sib->scale$inline (scale x) (declare (xargs :guard (and (2bits-p scale) (sib-p x)))) (mbe :logic (b* ((scale (mbe :logic (2bits-fix scale) :exec scale)) (x (sib-fix x))) (part-install scale x :width 2 :low 6)) :exec (the (unsigned-byte 8) (logior (the (unsigned-byte 8) (logand (the (unsigned-byte 8) x) (the (signed-byte 9) -193))) (the (unsigned-byte 8) (ash (the (unsigned-byte 2) scale) 6))))))
Theorem:
(defthm sib-p-of-!sib->scale (b* ((new-x (!sib->scale$inline scale x))) (sib-p new-x)) :rule-classes :rewrite)
Theorem:
(defthm !sib->scale$inline-of-2bits-fix-scale (equal (!sib->scale$inline (2bits-fix scale) x) (!sib->scale$inline scale x)))
Theorem:
(defthm !sib->scale$inline-2bits-equiv-congruence-on-scale (implies (2bits-equiv scale scale-equiv) (equal (!sib->scale$inline scale x) (!sib->scale$inline scale-equiv x))) :rule-classes :congruence)
Theorem:
(defthm !sib->scale$inline-of-sib-fix-x (equal (!sib->scale$inline scale (sib-fix x)) (!sib->scale$inline scale x)))
Theorem:
(defthm !sib->scale$inline-sib-equiv-congruence-on-x (implies (sib-equiv x x-equiv) (equal (!sib->scale$inline scale x) (!sib->scale$inline scale x-equiv))) :rule-classes :congruence)
Theorem:
(defthm !sib->scale-is-sib (equal (!sib->scale scale x) (change-sib x :scale scale)))
Theorem:
(defthm sib->scale-of-!sib->scale (b* ((?new-x (!sib->scale$inline scale x))) (equal (sib->scale new-x) (2bits-fix scale))))
Theorem:
(defthm !sib->scale-equiv-under-mask (b* ((?new-x (!sib->scale$inline scale x))) (sib-equiv-under-mask new-x x 63)))