Functions that enable the use of extended GPRs using the
Function:
(defun reg-indexp (reg rex-byte) (declare (type (unsigned-byte 8) rex-byte)) (let ((__function__ 'reg-indexp)) (declare (ignorable __function__)) (if (eql rex-byte 0) (n03p reg) (n04p reg))))
Theorem:
(defthm reg-indexp-for-3-bits (implies (and (syntaxp (quotep reg)) (n03p reg)) (reg-indexp reg rex)))
Theorem:
(defthm reg-indexp-logand-7 (implies (n08p rex-byte) (reg-indexp (loghead 3 modr/m) rex-byte)))
Function:
(defun reg-index$inline (reg rex-byte index) (declare (type (unsigned-byte 3) reg) (type (unsigned-byte 8) rex-byte) (type (unsigned-byte 2) index)) (if (logbitp index rex-byte) (logior 8 (mbe :logic (n03 reg) :exec reg)) (mbe :logic (n03 reg) :exec reg)))
Theorem:
(defthm reg-indexp-reg-index (reg-indexp (reg-index reg rex-byte name) rex-byte))
Theorem:
(defthm n04p-reg-index (unsigned-byte-p 4 (reg-index reg rex-byte name)) :rule-classes (:rewrite (:type-prescription :corollary (natp (reg-index reg rex-byte name)) :hints (("Goal" :in-theory '(unsigned-byte-p integer-range-p natp)))) (:linear :corollary (and (<= 0 (reg-index reg rex-byte name)) (< (reg-index reg rex-byte name) 16)) :hints (("Goal" :in-theory '(unsigned-byte-p integer-range-p (:e expt)))))))
Theorem:
(defthm reg-indexp-forward (implies (reg-indexp reg rex-byte) (unsigned-byte-p 4 reg)) :rule-classes :forward-chaining)