bgtpseudo
bgt
rs1, rs2, labelpseudo
if (rs1 > rs2) goto label

bgt branches when one value is greater than another. The name is branch if greater than: bgt rs1, rs2, label jumps to the label when rs1 is strictly greater than rs2, using signed comparison.

You might wonder why this was not in the family of six core branches. The answer is a small, elegant trick. RISC-V provides no greater-than instruction because it does not need one: asking is a greater than b is exactly the same as asking is b less than a — just with the two values swapped. So bgt is a pseudo-instruction, and the assembler simply rewrites it as blt with the operands reversed. The hardware stays simpler, and you still get to write the comparison in the direction that reads naturally. (See blt for the underlying less-than branch.)

Use bgt wherever your thought is naturally phrased as above: branch away when a value exceeds a maximum, when a length is larger than the space for it, or to take the bigger of two paths.

The word strictly matters: bgt does *not* branch when the two values are equal. If you want equal to count as well, the right instruction is bge (greater than or equal). Getting this distinction right is the usual fix for loops and checks that are off by one at the boundary. The comparison is signed; for unsigned data the same swap trick applies to bltu.

Expands to
blt rs2, rs1, label

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