• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Pfcs
      • Legacy-defrstobj
      • C
      • Proof-checker-array
      • Soft
      • Farray
      • Rp-rewriter
      • Instant-runoff-voting
      • Imp-language
      • Sidekick
      • Ethereum
      • Leftist-trees
      • Java
      • Riscv
      • Taspi
      • Bitcoin
      • Zcash
      • Des
      • 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
          • App-view
          • Top-level-memory
          • 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
              • 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
                • Gpr-arith/logic-spec-8
                  • Gpr-xadd-spec-8
                    • Gpr-adc-spec-8
                    • Gpr-sbb-spec-8
                    • Gpr-add-spec-8
                    • Gpr-adcx/adox-spec-8
                    • Gpr-sub-spec-8
                    • Gpr-xor-spec-8
                    • Gpr-and-spec-8
                    • Gpr-or-spec-8
                  • Gpr-arith/logic-spec-4
                  • Gpr-arith/logic-spec-2
                  • Gpr-arith/logic-spec-1
                • 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
        • Sha-2
        • Yul
        • Proof-checker-itp13
        • Regex
        • ACL2-programming-language
        • Json
        • Jfkr
        • Equational
        • Cryptography
        • Axe
        • Poseidon
        • Where-do-i-place-my-book
        • Aleo
        • Bigmems
        • Builtins
        • Execloader
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Community
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Gpr-arith/logic-spec-8

    Gpr-xadd-spec-8

    Signature
    (gpr-xadd-spec-8 dst src input-rflags) → (mv * * *)

    Definitions and Theorems

    Function: gpr-xadd-spec-8$inline

    (defun gpr-xadd-spec-8$inline (dst src input-rflags)
     (declare (type (unsigned-byte 64) dst)
              (type (unsigned-byte 64) src)
              (type (unsigned-byte 32) input-rflags))
     (b*
      ((dst (mbe :logic (n-size 64 dst) :exec dst))
       (src (mbe :logic (n-size 64 src) :exec src))
       (input-rflags (mbe :logic (n32 input-rflags)
                          :exec input-rflags))
       (raw-result (the (unsigned-byte 65)
                        (+ (the (unsigned-byte 64) dst)
                           (the (unsigned-byte 64) src))))
       (signed-raw-result
            (the (signed-byte 65)
                 (+ (the (signed-byte 64) (n64-to-i64 dst))
                    (the (signed-byte 64)
                         (n64-to-i64 src)))))
       (result (the (unsigned-byte 64)
                    (n-size 64 raw-result)))
       (cf (the (unsigned-byte 1)
                (cf-spec64 raw-result)))
       (pf (the (unsigned-byte 1)
                (pf-spec64 result)))
       (af (the (unsigned-byte 1)
                (add-af-spec64 dst src)))
       (zf (the (unsigned-byte 1)
                (zf-spec result)))
       (sf (the (unsigned-byte 1)
                (sf-spec64 result)))
       (of (the (unsigned-byte 1)
                (of-spec64 signed-raw-result)))
       (output-rflags
        (mbe
         :logic (change-rflagsbits input-rflags
                                   :cf cf
                                   :pf pf
                                   :af af
                                   :zf zf
                                   :sf sf
                                   :of of)
         :exec
         (the
          (unsigned-byte 32)
          (!rflagsbits->cf
           cf
           (!rflagsbits->pf
            pf
            (!rflagsbits->af
             af
             (!rflagsbits->zf
              zf
              (!rflagsbits->sf sf
                               (!rflagsbits->of of input-rflags)))))))))
       (output-rflags (mbe :logic (n32 output-rflags)
                           :exec output-rflags))
       (undefined-flags 0))
      (mv result output-rflags undefined-flags)))

    Theorem: n64-mv-nth-0-gpr-xadd-spec-8

    (defthm n64-mv-nth-0-gpr-xadd-spec-8
     (unsigned-byte-p 64
                      (mv-nth 0
                              (gpr-xadd-spec-8 dst src input-rflags)))
     :rule-classes
     (:rewrite
      (:type-prescription
       :corollary (natp (mv-nth 0
                                (gpr-xadd-spec-8 dst src input-rflags)))
       :hints
       (("Goal" :in-theory '(unsigned-byte-p integer-range-p natp))))
      (:linear
       :corollary
       (and (<= 0
                (mv-nth 0
                        (gpr-xadd-spec-8 dst src input-rflags)))
            (< (mv-nth 0
                       (gpr-xadd-spec-8 dst src input-rflags))
               18446744073709551616))
       :hints
       (("Goal"
            :in-theory '(unsigned-byte-p integer-range-p (:e expt)))))))

    Theorem: mv-nth-1-gpr-xadd-spec-8

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

    Theorem: mv-nth-2-gpr-xadd-spec-8

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