TBNZ
Test bit and Branch if Nonzero compares the value of a bit in a general-purpose register with zero, and conditionally branches to a label at a PC-relative offset if the comparison is not equal. It provides a hint that this is not a subroutine call or return. This instruction does not affect condition flags.
TBNZ TBNZ X1,#3, label // 若X1[3] !=0, 则跳转到label
如果非零,则测试位和分支将通用寄存器中的位值与零进行比较,如果比较不相等,则有条件地分支到PC相对偏移处的标签。它提供了一个提示,表明这不是子程序调用或返回。此指令不影响条件标志。
402984: aa1403e0 mov x0, x20 // x0=x20=path
402988: 52800001 mov w1, #0x0 // #0
40298c: 97fffc81 bl 401b90 <open@plt> // open(path, 0)
402990: 37f80fa0 tbnz w0, #31, 402b84 <ferror@plt+0xca4> // 最高位为1,即负数
if ((fd = open(path, O_RDONLY)) < 0) {
// tbnz 402b84
fclose(file);
free(path);
contine;
// b 402130
}