Contents

TEQ : Test Equivalence

The TEQ instruction allows you to test is two operands are equal. Unlike CMP, the V flag is not updated. The internal operation is a logical EOR of the two operands.
Operand 1 is a register, operand 2 may be a register, shifted register, or an immediate value (which may be shifted).

There is no S bit, it is implied. The N, Z, and C flags are updated as usual (N - result bit 31, Z if result zero, C is shifter carry out). V is not updated.

TEQ is important in conditional execution and decision making.

There is also a Test bits instruction for testing of specific bits are set or clear.

Syntax

TEQ <op 1>, <op 2>

Function

<flags> = op_1 EOR op_2 ; result is not stored, only flags updated

Example

While it may seem as if this behaves like CMP (and, indeed, replacing the TEQ in the example with CMP will behave the same way), this is not always true. For CMP does an addition internally, while TEQ performs an Exclusive OR.

TEQP in 26 bit modes

TEQP is used, in 26 bit modes, to write values to R15 status bits. For example, to disable interrupts (while preserving other registers), you would: