30.4.4.2. ARM S suffix

The S suffix, present on most ARM data processing instructions, makes the instruction also set the Status register flags that control conditional jumps.

If the result of the operation is 0, then it triggers BEQ, since comparison is a subtraction, with success on 0.

CMP sets the flags by default of course.