# `sge`

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

Web page: https://asm-editor.specy.app/documentation/mips/instruction/sge

**Set if greater or equal** · Pseudo-instruction

Category: Comparison

Sets the first register to 1 if the second is greater than or equal to the third, or an immediate, as signed values, otherwise to 0.

## Forms

- `sge $t1, $t2, $t3`
  - `sge $t1,$t2,$t3` → `slt $t1, $t2, $t3`; `ori $at, $zero, 1`; `subu $t1, $at, $t1`
- `sge $t1, $t2, imm`
  - `sge $t1,$t2,-100`: If $t2 greater or equal to 16-bit immediate then set $t1 to 1 else 0 → `addi $at, $zero, imm`; `slt $t1, $t2, $at`; `ori $at, $zero, 1`; `subu $t1, $at, $t1`
  - `sge $t1,$t2,100000`: If $t2 greater or equal to 32-bit immediate then set $t1 to 1 else 0 → `lui $at, hi(imm)`; `ori $at, $at, lo(imm)`; `slt $t1, $t2, $at`; `ori $at, $zero, 1`; `subu $t1, $at, $t1`

## Operands

- `$t1`: Any general-purpose register, `$0` to `$31`, using its numeric or named spelling, such as `$8` or `$t0` (`$zero` is `$0`; `$ra` is `$31`).
- `$t2`: A general-purpose register. It may be the same register as `$t1`.
- `$t3`: A general-purpose register. It may be the same register as `$t1`.
- `imm`: An immediate value: a signed 16-bit value (`-32768` to `32767`) or a 32-bit value (`-2147483648` to `4294967295`). The size your value needs decides which real instructions the assembler uses. Open the row to see them for each size.

## Example

```mips
# Compare signed and unsigned bit patterns: $t0 is -1 (0xFFFFFFFF), $t1 is 1. Inspect $t2: 0.
li $t0, -1
li $t1, 1
sge $t2, $t0, $t1
```
