Instructions-II

Learn about logical comparison with TST, comparison of two operands with CMP, and comparison between TST and CMP.

Logical compare: TST

This instruction computes the bit-wise logical AND between both operands and sets flags (including Z) according to the computed result, which is discarded.

Press + to interact
TST reg, reg
TST reg, #imm

Examples

TST   x0, #4

Suppose the x0 register contains 4 (which in binary is 100bin100_{\text{bin}})

100bin  100_{\text{bin}}\space\space AND   100bin   =  100bin\space\space100_{\text{bin}}\space\space\space = \space\space100_{\text{bin}}      !=0 ...

Access this course and 1400+ top-rated courses and projects.