(shrd-spec-32 dst src cnt input-rflags) → (mv output-dst undefined-dst? output-rflags undefined-flags)
Function:
(defun shrd-spec-32 (dst src cnt input-rflags) (declare (type (unsigned-byte 32) dst) (type (unsigned-byte 32) src) (type (unsigned-byte 6) cnt) (type (unsigned-byte 32) input-rflags)) (let ((__function__ 'shrd-spec-32)) (declare (ignorable __function__)) (b* ((dst (mbe :logic (n-size 32 dst) :exec dst)) (src (mbe :logic (n-size 32 src) :exec src)) (cnt (mbe :logic (n-size 6 cnt) :exec cnt)) (input-rflags (mbe :logic (n32 input-rflags) :exec input-rflags)) (src-dst (the (unsigned-byte 64) (logior (the (unsigned-byte 64) (ash (the (unsigned-byte 32) src) 32)) (the (unsigned-byte 32) dst)))) (neg-cnt (the (signed-byte 33) (- cnt))) (output-dst (the (unsigned-byte 32) (n-size 32 (ash (the (unsigned-byte 64) src-dst) (the (signed-byte 33) neg-cnt))))) ((mv (the (unsigned-byte 32) output-rflags) (the (unsigned-byte 32) undefined-flags)) (case cnt (0 (mv input-rflags 0)) (1 (b* ((cf (mbe :logic (part-select dst :low 0 :width 1) :exec (the (unsigned-byte 1) (logand (the (unsigned-byte 32) dst) 1)))) (of (if (= (logbit 31 dst) (logbit 31 output-dst)) 0 1)) (pf (general-pf-spec 32 output-dst)) (zf (zf-spec output-dst)) (sf (general-sf-spec 32 output-dst)) (output-rflags (mbe :logic (change-rflagsbits input-rflags :cf cf :of of :pf pf :zf zf :sf sf) :exec (the (unsigned-byte 32) (!rflagsbits->cf cf (!rflagsbits->of of (!rflagsbits->pf pf (!rflagsbits->zf zf (!rflagsbits->sf sf input-rflags)))))))) (undefined-flags (the (unsigned-byte 32) (!rflagsbits->af 1 0)))) (mv output-rflags undefined-flags))) (otherwise (if (<= cnt 32) (b* ((cf (mbe :logic (part-select dst :low (1- cnt) :width 1) :exec (logand 1 (the (unsigned-byte 32) (ash (the (unsigned-byte 32) dst) (the (signed-byte 33) (1+ neg-cnt))))))) (pf (general-pf-spec 32 output-dst)) (zf (zf-spec output-dst)) (sf (general-sf-spec 32 output-dst)) (output-rflags (mbe :logic (change-rflagsbits input-rflags :cf cf :pf pf :zf zf :sf sf) :exec (the (unsigned-byte 32) (!rflagsbits->cf cf (!rflagsbits->pf pf (!rflagsbits->zf zf (!rflagsbits->sf sf input-rflags))))))) (undefined-flags (mbe :logic (change-rflagsbits 0 :af 1 :of 1) :exec (!rflagsbits->af 1 (!rflagsbits->of 1 0))))) (mv output-rflags undefined-flags)) (b* ((output-rflags input-rflags) (undefined-flags (the (unsigned-byte 32) (!rflagsbits->cf 1 (!rflagsbits->of 1 (!rflagsbits->pf 1 (!rflagsbits->zf 1 (!rflagsbits->sf 1 (!rflagsbits->af 1 input-rflags))))))))) (mv output-rflags undefined-flags)))))) (output-rflags (mbe :logic (n32 output-rflags) :exec output-rflags)) (undefined-flags (mbe :logic (n32 undefined-flags) :exec undefined-flags))) (mv output-dst (> cnt 32) output-rflags undefined-flags))))
Theorem:
(defthm n32-mv-nth-0-shrd-spec-32 (unsigned-byte-p 32 (mv-nth 0 (shrd-spec-32 dst src cnt input-rflags))) :rule-classes (:rewrite (:type-prescription :corollary (natp (mv-nth 0 (shrd-spec-32 dst src cnt input-rflags))) :hints (("Goal" :in-theory '(unsigned-byte-p integer-range-p natp)))) (:linear :corollary (and (<= 0 (mv-nth 0 (shrd-spec-32 dst src cnt input-rflags))) (< (mv-nth 0 (shrd-spec-32 dst src cnt input-rflags)) 4294967296)) :hints (("Goal" :in-theory '(unsigned-byte-p integer-range-p (:e expt)))))))
Theorem:
(defthm booleanp-mv-nth-1-shrd-spec-32 (booleanp (mv-nth 1 (shrd-spec-32 dst src cnt input-rflags))))
Theorem:
(defthm mv-nth-2-shrd-spec-32 (unsigned-byte-p 32 (mv-nth 2 (shrd-spec-32 dst src cnt input-rflags))) :rule-classes (:rewrite (:type-prescription :corollary (natp (mv-nth 2 (shrd-spec-32 dst src cnt input-rflags))) :hints (("Goal" :in-theory '(unsigned-byte-p integer-range-p natp)))) (:linear :corollary (and (<= 0 (mv-nth 2 (shrd-spec-32 dst src cnt input-rflags))) (< (mv-nth 2 (shrd-spec-32 dst src cnt input-rflags)) 4294967296)) :hints (("Goal" :in-theory '(unsigned-byte-p integer-range-p (:e expt)))))))
Theorem:
(defthm mv-nth-3-shrd-spec-32 (unsigned-byte-p 32 (mv-nth 3 (shrd-spec-32 dst src cnt input-rflags))) :rule-classes (:rewrite (:type-prescription :corollary (natp (mv-nth 3 (shrd-spec-32 dst src cnt input-rflags))) :hints (("Goal" :in-theory '(unsigned-byte-p integer-range-p natp)))) (:linear :corollary (and (<= 0 (mv-nth 3 (shrd-spec-32 dst src cnt input-rflags))) (< (mv-nth 3 (shrd-spec-32 dst src cnt input-rflags)) 4294967296)) :hints (("Goal" :in-theory '(unsigned-byte-p integer-range-p (:e expt)))))))