AND

By Vesper Vei
1 minute read

Table of Contents

  1. AND (and)
    1. Basic function
    2. Instruction format
    3. Behavioral characteristics
    4. Example
    5. Common uses

AND (and)

Basic function

AND performs a bitwise logical AND operation:

x1 = x1 & x2

Instruction format

and x1, x2

x1 can be a register or memory
x2 is a register or an immediate value
but memory-to-memory is not allowed

Behavioral characteristics

Example

and eax, 0xFF
; 保留低 8 位
and rax, rbx
and [rbp-0x8], 0x1

Common uses

For example, aligning to 16 bytes:

and rsp, -0x10


Relationship Graph

Loading graph...