• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
      • X86isa
        • Program-execution
        • Sdm-instruction-set-summary
        • Tlb
        • Running-linux
        • Introduction
        • Asmtest
        • X86isa-build-instructions
        • Publications
        • Contributors
        • Machine
          • X86isa-state
          • Syscalls
          • Cpuid
          • Linear-memory
          • Rflag-specifications
          • Characterizing-undefined-behavior
          • Top-level-memory
          • App-view
          • X86-decoder
          • Physical-memory
          • Decoding-and-spec-utils
          • Instructions
            • Two-byte-opcodes
            • One-byte-opcodes
            • Fp-opcodes
            • Instruction-semantic-functions
              • Sar-spec
              • Shr-spec
              • Sal/shl-spec
              • Rol-spec
              • Ror-spec
                • Ror-spec-8
                • Ror-spec-64
                • Ror-spec-32
                • Ror-spec-16
              • Rcl-spec
              • Rcr-spec
              • Simd-sub-spec
              • Simd-add-spec
              • Imul-spec
              • Mul-spec
              • Idiv-spec
              • Div-spec
              • Shrd-spec
              • Shld-spec
              • Gpr-arith/logic-spec
              • Shrx-spec
              • Shlx-spec
              • Sarx-spec
              • Floating-point-specifications
            • X86-illegal-instruction
            • Implemented-opcodes
            • Opcode-maps
            • X86-general-protection
            • X86-device-not-available
            • X86-step-unimplemented
            • Privileged-opcodes
            • Three-byte-opcodes
          • Register-readers-and-writers
          • X86-modes
          • Segmentation
          • Other-non-deterministic-computations
          • Environment
          • Paging
        • Implemented-opcodes
        • To-do
        • Proof-utilities
        • Peripherals
        • Model-validation
        • Modelcalls
        • Concrete-simulation-examples
        • Utils
        • Debugging-code-proofs
      • Axe
      • Execloader
    • Math
    • Testing-utilities
  • Instruction-semantic-functions

Ror-spec

Specification for the ROR instruction

Signature
(ror-spec size dst src input-rflags) → (mv * * *)

Source: Intel Manual, Volume 2B, Instruction Set Reference (N-Z).

For the ROL and ROR instructions, the original value of the CF flag is not a part of the result, but the CF flag receives a copy of the bit that was shifted from one end to the other. ... The OF flag is defined only for the 1-bit rotates; it is undefined in all other cases (except RCL and RCR instructions only: a zero-bit rotate does nothing, that is affects no flags). For right rotates, the OF flag is set to the exclusive OR of the two most-significant bits of the result.

Definitions and Theorems

Function: ror-spec$inline

(defun ror-spec$inline (size dst src input-rflags)
  (declare (type (member 1 2 4 8) size)
           (type (unsigned-byte 32) input-rflags))
  (declare (xargs :guard (and (n06p src)
                              (case size
                                (1 (n08p dst))
                                (2 (n16p dst))
                                (4 (n32p dst))
                                (8 (n64p dst))
                                (otherwise nil)))))
  (case size
    (1 (ror-spec-8 dst src input-rflags))
    (2 (ror-spec-16 dst src input-rflags))
    (4 (ror-spec-32 dst src input-rflags))
    (8 (ror-spec-64 dst src input-rflags))
    (otherwise (mv 0 0 0))))

Theorem: natp-mv-nth-0-ror-spec

(defthm natp-mv-nth-0-ror-spec
  (natp (mv-nth 0 (ror-spec size dst src input-rflags)))
  :rule-classes :type-prescription)

Theorem: n32p-mv-nth-1-ror-spec

(defthm n32p-mv-nth-1-ror-spec
 (unsigned-byte-p 32
                  (mv-nth 1 (ror-spec size dst src input-rflags)))
 :rule-classes
 (:rewrite
  (:type-prescription
   :corollary (natp (mv-nth 1 (ror-spec size dst src input-rflags)))
   :hints
   (("Goal" :in-theory '(unsigned-byte-p integer-range-p natp))))
  (:linear
   :corollary
   (and (<= 0
            (mv-nth 1 (ror-spec size dst src input-rflags)))
        (< (mv-nth 1 (ror-spec size dst src input-rflags))
           4294967296))
   :hints
   (("Goal"
        :in-theory '(unsigned-byte-p integer-range-p (:e expt)))))))

Theorem: n32p-mv-nth-2-ror-spec

(defthm n32p-mv-nth-2-ror-spec
 (unsigned-byte-p 32
                  (mv-nth 2 (ror-spec size dst src input-rflags)))
 :rule-classes
 (:rewrite
  (:type-prescription
   :corollary (natp (mv-nth 2 (ror-spec size dst src input-rflags)))
   :hints
   (("Goal" :in-theory '(unsigned-byte-p integer-range-p natp))))
  (:linear
   :corollary
   (and (<= 0
            (mv-nth 2 (ror-spec size dst src input-rflags)))
        (< (mv-nth 2 (ror-spec size dst src input-rflags))
           4294967296))
   :hints
   (("Goal"
        :in-theory '(unsigned-byte-p integer-range-p (:e expt)))))))

Subtopics

Ror-spec-8
Ror-spec-64
Ror-spec-32
Ror-spec-16