bnezpseudo
bnez
rs, labelpseudo
if (rs != 0) goto label

bnez is the opposite of beqz: it branches when a register holds anything *other* than zero. The name is branch if not equal to zero, and bnez rs, label jumps to the label if rs is non-zero. It is a pseudo-instruction the assembler rewrites to bne rs, zero, label, comparing against the always-zero register. (See beqz for the zero-test idea and beq for branches generally.)

If beqz tends to guard exits, bnez tends to drive continuation — the keep-going condition of a loop. While there are still characters to read, keep scanning; while the counter has not run out, keep going. A very tight and common loop ending counts a register down and loops while it is still non-zero: subtract one, then bnez back to the top.

It also acts on true/false values computed earlier. The set instructions like slt produce a 1 or 0 in a register; a following bnez then branches on that result — the two-step pattern of compute a condition here, act on it there. Any register holding a yes/no value is ready for bnez.

One more frequent use is checking results: when a function returns 0 for success and non-zero for failure, the caller follows it with bnez a0, error to jump to error handling whenever something went wrong — the assembly form of checking a return code.

Expands to
bne rs, zero, label

A pseudo-instruction: the assembler turns it into the real instruction(s) above.