# `not`

[x86-64 Documentation](https://asm-editor.specy.app/documentation/x86.md) › [Instructions](https://asm-editor.specy.app/documentation/x86/instruction.md)

Web page: https://asm-editor.specy.app/documentation/x86/instruction/not

**One's complement negation**

Category: Logic

Inverts every bit of the operand to give its ones complement, leaving the flags unchanged.

8086 and later · accepts the `lock` prefix with a memory operand

[Intel's reference: NOT](https://intel.github.io/SDM/instruction/NOT.html)

Used in: [Arithmetic, logic and bits](https://asm-editor.specy.app/learn/courses/x86/think-in-assembly/arithmetic-logic-and-bits.md) (x86-64 assembly)

## Flags

| Flag | Effect |
| --- | --- |
| CF | not changed |
| PF | not changed |
| AF | not changed |
| ZF | not changed |
| SF | not changed |
| DF | not changed |
| OF | not changed |

## Forms

- `not r/m` (8, 16, 32, 64)
  - `not r/m8`
  - `not r/m16`
  - `not r/m32`: 386 and later
  - `not r/m64`

## Operands

- `r/m`: A general-purpose register or memory location matching the operation’s size, for example `rax` or `qword [rbp-8]`.

## Description

`NOT`, similarly, performs one's complement (inverts all
the bits).

## Example

```x86
global _start

section .text
_start:
        mov rax, 12
        mov rbx, 5
        mov rcx, 3
        mov rsi, 9

        not rax

        mov rax, 60         ; syscall 60: exit
        xor rdi, rdi
        syscall
```
