# `jge`

[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/jge

**Jump if greater or equal (SF == OF)**

Category: Control flow

Jumps to the target when the last comparison found greater or equal (SF equals OF).

8086 and later

Also written as: `jnl`

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

Used in: [cmp and the conditional jumps](https://asm-editor.specy.app/learn/courses/x86/think-in-assembly/cmp-and-the-conditional-jumps.md) (x86-64 assembly), [call, ret and the System V convention](https://asm-editor.specy.app/learn/courses/x86/think-in-assembly/call-ret-and-the-system-v-convention.md) (x86-64 assembly), [The bigger of two numbers](https://asm-editor.specy.app/learn/courses/x86/examples/if-else.md) (x86-64 assembly), [Recursion: factorial and Fibonacci](https://asm-editor.specy.app/learn/courses/x86/examples/factorial-and-fibonacci.md) (x86-64 assembly), [Drawing shapes on the screen](https://asm-editor.specy.app/learn/courses/x86/examples/drawing-on-the-screen.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 |

Reads: SF, OF

## Forms

- `jge short imm8`
- `jge imm`
- `jge near imm32` · 386 and later

## Operands

- `imm8`: A branch target, written as a label or address. NASM calculates the displacement from the end of the instruction. The displacement must fit a signed byte, `-128` to `127`.
- `imm`: A branch target, written as a label or address. NASM calculates the displacement from the end of the instruction. NASM selects a short or near encoding according to the target’s reach and any size constraint.
- `imm32`: A branch target, written as a label or address. NASM calculates the displacement from the end of the instruction. In 64-bit mode the encoded displacement is signed 32-bit, `-2147483648` to `2147483647`, even though the target address is 64-bit.

## Description

The condition reads the current flags, commonly set by `cmp` or `test`. Signed comparisons use SF and OF; unsigned comparisons use CF. The [condition-code table](https://asm-editor.specy.app/documentation/x86/registers/condition-codes.md) lists the flag tests and synonymous mnemonics.

Write the target label or address, such as `jne retry`. NASM calculates a displacement from the end of the jump. The short form reaches −128 through 127 bytes from that point; the longer near form in 64-bit mode uses a signed 32-bit displacement (about ±2 GiB). NASM normally selects the short form when possible. `short` requires the short range, while `strict near` keeps the longer form.

Conditional jumps have no register or memory-indirect target form. To conditionally reach an arbitrary 64-bit address, branch around an indirect `jmp`.

## Example

```x86
global _start

section .text
_start:
        mov rax, 12
        cmp rax, 12         ; sets the flags the condition reads
        jge taken
        mov rbx, 1          ; runs when the condition is false
        jmp done
taken:
        mov rbx, 2          ; runs when it is true
done:

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