# `bleu`

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

**Branch if less or equal unsigned** · Pseudo-instruction

Category: Control flow

Branches to label if the first register is less than or equal to the second, or an immediate, as unsigned values.

## Forms

- `bleu $t1, $t2, label`
  - `bleu $t1,$t2,label` → `sltu $at, $t2, $t1`; `beq $at, $zero, label`
- `bleu $t1, imm, label`
  - `bleu $t1,-100,label`: Branch to statement at label if $t1 is less than or equal to 16-bit immediate (unsigned compare) → `addi $at, $zero, imm`; `sltu $at, $at, $t1`; `beq $at, $zero, label`
  - `bleu $t1,100000,label`: Branch to statement at label if $t1 is less than or equal to 32-bit immediate (unsigned compare) → `lui $at, hi(imm)`; `ori $at, $at, lo(imm)`; `sltu $at, $at, $t1`; `beq $at, $zero, label`

## 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`.
- `label`: A named address in the program, such as the start of a loop or a variable in `.data`.
- `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 unsigned operands with bleu; the first case is taken and the second falls through. $t2=2 marks taken; $t3=1 marks fall-through.
li $t0, 0
li $t1, 1
li $t2, 0
bleu $t0, $t1, taken_one
li $t2, 1
b first_done # Skip the other marker unconditionally.
 taken_one: li $t2, 2
first_done:
li $t0, 2
li $t1, 1
li $t3, 0
bleu $t0, $t1, taken_two
li $t3, 1
b second_done # Skip the other marker unconditionally.
 taken_two: li $t3, 2
second_done:
```
