Access the |X86ISA|::|INDEX| field of a sib bit structure.
Function:
(defun sib->index$inline (x) (declare (xargs :guard (sib-p x))) (mbe :logic (let ((x (sib-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-sib->index (b* ((index (sib->index$inline x))) (3bits-p index)) :rule-classes :rewrite)
Theorem:
(defthm sib->index$inline-of-sib-fix-x (equal (sib->index$inline (sib-fix x)) (sib->index$inline x)))
Theorem:
(defthm sib->index$inline-sib-equiv-congruence-on-x (implies (sib-equiv x x-equiv) (equal (sib->index$inline x) (sib->index$inline x-equiv))) :rule-classes :congruence)
Theorem:
(defthm sib->index-of-sib (equal (sib->index (sib base index scale)) (3bits-fix index)))
Theorem:
(defthm sib->index-of-write-with-mask (implies (and (fty::bitstruct-read-over-write-hyps x sib-equiv-under-mask) (sib-equiv-under-mask x y fty::mask) (equal (logand (lognot fty::mask) 56) 0)) (equal (sib->index x) (sib->index y))))