(x86-btr-0f-b3 proc-mode start-rip temp-rip prefixes rex-byte opcode modr/m sib x86) → x86
Function:
(defun x86-btr-0f-b3 (proc-mode start-rip temp-rip prefixes rex-byte opcode modr/m sib x86) (declare (xargs :stobjs (x86))) (declare (type (integer 0 4) proc-mode) (type (signed-byte 48) start-rip) (type (signed-byte 48) temp-rip) (type (unsigned-byte 52) prefixes) (type (unsigned-byte 8) rex-byte) (type (unsigned-byte 8) opcode) (type (unsigned-byte 8) modr/m) (type (unsigned-byte 8) sib)) (declare (ignorable proc-mode start-rip temp-rip prefixes rex-byte opcode modr/m sib)) (declare (xargs :guard (and (prefixes-p prefixes) (modr/m-p modr/m) (sib-p sib) (rip-guard-okp proc-mode temp-rip)))) (let ((__function__ 'x86-btr-0f-b3)) (declare (ignorable __function__)) (b* ((?ctx 'x86-btr-0f-b3) (?r/m (the (unsigned-byte 3) (modr/m->r/m modr/m))) (?mod (the (unsigned-byte 2) (modr/m->mod modr/m))) (?reg (the (unsigned-byte 3) (modr/m->reg modr/m)))) (b* (((the (integer 1 8) operand-size) (select-operand-size proc-mode nil rex-byte nil prefixes nil nil nil x86)) (p2 (prefixes->seg prefixes)) (p4? (equal 103 (prefixes->adr prefixes))) (inst-ac? (alignment-checking-enabled-p x86)) (seg-reg (select-segment-register proc-mode p2 p4? mod r/m sib x86)) (bitoffset (rgfi-size operand-size (reg-index reg rex-byte *r*) rex-byte x86)) ((mv flg0 (the (signed-byte 64) addr) (the (unsigned-byte 3) increment-rip-by) x86) (if (equal mod 3) (mv nil 0 0 x86) (let ((p4? (equal 103 (prefixes->adr prefixes)))) (x86-effective-addr proc-mode p4? temp-rip rex-byte r/m mod sib 0 x86)))) ((when flg0) (!!ms-fresh :x86-effective-addr-error flg0)) ((mv flg (the (signed-byte 48) temp-rip)) (add-to-*ip proc-mode temp-rip increment-rip-by x86)) ((when flg) (!!ms-fresh :rip-increment-error temp-rip)) (badlength? (check-instruction-length start-rip temp-rip 0)) ((when badlength?) (!!fault-fresh :gp 0 :instruction-length badlength?)) ((mv flg2 bitoffset bitbase ?byte-addr x86) (if (equal mod 3) (mv nil (mod bitoffset (ash operand-size 3)) (rgfi-size operand-size (reg-index r/m rex-byte 0) rex-byte x86) nil x86) (b* ((bitoffset-int (case operand-size (1 (n08-to-i08 bitoffset)) (2 (n16-to-i16 bitoffset)) (4 (n32-to-i32 bitoffset)) (t (n64-to-i64 bitoffset)))) (bitoffset-int-abs (abs bitoffset-int)) (bitnumber (mod bitoffset-int-abs 8)) (byte-addr (+ addr (floor bitoffset-int 8))) ((mv flg byte x86) (if (signed-byte-p 64 byte-addr) (rme-size-opt proc-mode 1 byte-addr seg-reg :r inst-ac? x86 :check-canonicity t) (mv (cons 'effective-address-error byte-addr) 0 x86)))) (mv flg bitnumber byte byte-addr x86)))) ((when flg2) (!!ms-fresh :rme-size-error flg2)) (x86 (let* ((x86 (!flgi :cf (the (unsigned-byte 1) (logbit bitoffset bitbase)) x86)) (x86 (!flgi-undefined :pf x86)) (x86 (!flgi-undefined :af x86)) (x86 (!flgi-undefined :sf x86)) (x86 (!flgi-undefined :of x86))) x86)) (val (part-install 0 bitbase :width 1 :low bitoffset)) ((mv flg x86) (if (equal mod 3) (let ((x86 (!rgfi-size operand-size (reg-index r/m rex-byte 0) val rex-byte x86))) (mv nil x86)) (wme-size proc-mode 1 byte-addr seg-reg (loghead 8 val) inst-ac? x86))) ((when flg) (!!ms-fresh :wme-size flg)) (x86 (write-*ip proc-mode temp-rip x86))) x86))))
Theorem:
(defthm x86p-of-x86-btr-0f-b3 (implies (x86p x86) (b* ((x86 (x86-btr-0f-b3 proc-mode start-rip temp-rip prefixes rex-byte opcode modr/m sib x86))) (x86p x86))) :rule-classes :rewrite)