(rcr-spec-32 dst src input-rflags) → (mv * * *)
Function:
(defun rcr-spec-32 (dst src input-rflags) (declare (type (unsigned-byte 32) dst) (type (unsigned-byte 6) src) (type (unsigned-byte 32) input-rflags)) (let ((__function__ 'rcr-spec-32)) (declare (ignorable __function__)) (b* ((dst (mbe :logic (n-size 32 dst) :exec dst)) (src (mbe :logic (n-size 6 src) :exec src)) (input-rflags (mbe :logic (n32 input-rflags) :exec input-rflags)) (input-cf (the (unsigned-byte 1) (rflagsbits->cf input-rflags))) (new-dst (mbe :logic (part-install input-cf dst :low 32 :width 1) :exec (the (unsigned-byte 33) (logior (the (unsigned-byte 33) (ash input-cf 32)) dst)))) (raw-result (the (unsigned-byte 33) (fast-rotate-right new-dst 33 src))) (result (the (unsigned-byte 32) (n-size 32 raw-result))) ((mv (the (unsigned-byte 32) output-rflags) (the (unsigned-byte 32) undefined-flags)) (case src (0 (mv input-rflags 0)) (1 (b* ((cf (mbe :logic (logbit 32 raw-result) :exec (logand 1 (the (unsigned-byte 1) (ash (the (unsigned-byte 33) raw-result) -32))))) (of (b-xor (mbe :logic (logbit 31 result) :exec (logand 1 (the (unsigned-byte 1) (ash (the (unsigned-byte 32) result) -31)))) (mbe :logic (part-select result :low 30 :width 1) :exec (logand 1 (the (unsigned-byte 2) (ash (the (unsigned-byte 32) result) -30)))))) (output-rflags (mbe :logic (change-rflagsbits input-rflags :cf cf :of of) :exec (the (unsigned-byte 32) (!rflagsbits->cf cf (!rflagsbits->of of input-rflags)))))) (mv output-rflags 0))) (otherwise (b* ((cf (mbe :logic (logbit 32 raw-result) :exec (the (unsigned-byte 1) (logand 1 (the (unsigned-byte 1) (ash (the (unsigned-byte 33) raw-result) -32)))))) (output-rflags (the (unsigned-byte 32) (!rflagsbits->cf cf input-rflags))) (undefined-flags (the (unsigned-byte 32) (!rflagsbits->of 1 0)))) (mv output-rflags undefined-flags)))))) (mv result output-rflags undefined-flags))))
Theorem:
(defthm n32-mv-nth-0-rcr-spec-32 (unsigned-byte-p 32 (mv-nth 0 (rcr-spec-32 dst src output-rflags))) :rule-classes (:rewrite (:type-prescription :corollary (natp (mv-nth 0 (rcr-spec-32 dst src output-rflags))) :hints (("Goal" :in-theory '(unsigned-byte-p integer-range-p natp)))) (:linear :corollary (and (<= 0 (mv-nth 0 (rcr-spec-32 dst src output-rflags))) (< (mv-nth 0 (rcr-spec-32 dst src output-rflags)) 4294967296)) :hints (("Goal" :in-theory '(unsigned-byte-p integer-range-p (:e expt)))))))
Theorem:
(defthm mv-nth-1-rcr-spec-32 (unsigned-byte-p 32 (mv-nth 1 (rcr-spec-32 dst src output-rflags))) :rule-classes (:rewrite (:type-prescription :corollary (natp (mv-nth 1 (rcr-spec-32 dst src output-rflags))) :hints (("Goal" :in-theory '(unsigned-byte-p integer-range-p natp)))) (:linear :corollary (and (<= 0 (mv-nth 1 (rcr-spec-32 dst src output-rflags))) (< (mv-nth 1 (rcr-spec-32 dst src output-rflags)) 4294967296)) :hints (("Goal" :in-theory '(unsigned-byte-p integer-range-p (:e expt)))))))
Theorem:
(defthm mv-nth-2-rcr-spec-32 (unsigned-byte-p 32 (mv-nth 2 (rcr-spec-32 dst src output-rflags))) :rule-classes (:rewrite (:type-prescription :corollary (natp (mv-nth 2 (rcr-spec-32 dst src output-rflags))) :hints (("Goal" :in-theory '(unsigned-byte-p integer-range-p natp)))) (:linear :corollary (and (<= 0 (mv-nth 2 (rcr-spec-32 dst src output-rflags))) (< (mv-nth 2 (rcr-spec-32 dst src output-rflags)) 4294967296)) :hints (("Goal" :in-theory '(unsigned-byte-p integer-range-p (:e expt)))))))