# `neg`

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

**Negate** · Pseudo-instruction

Category: Arithmetic

Sets the first register to the negation of the second.

## Forms

- `neg $t1, $t2`
  - `neg $t1,$t2` → `sub $t1, $zero, $t2`

## 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`.

## Example

```mips
# Negate 7. Inspect $t2: 0xFFFFFFF9 (-7).
li $t0, 7
neg $t2, $t0
```
