You copied the Doc URL to your clipboard.

13.159 TST

Test bits.

Syntax

TST{cond} Rn, Operand2

where:

cond

is an optional condition code.

Rn

is the ARM register holding the first operand.

Operand2

is a flexible second operand.

Operation

This instruction tests the value in a register against Operand2.It updates the condition flags on the result, but does not placethe result in any register.

The TST instruction performs abitwise AND operation on the value in Rn andthe value of Operand2. Thisis the same as an ANDS instruction, exceptthat the result is discarded.

Register restrictions

In this T32 instruction, you cannot use SP or PC for Rn or Operand2.

In this A32 instruction, use of SP or PC is deprecated.

For A32 instructions:

  • If you use PC (R15) as Rn, the value used is the address of the instruction plus 8.

  • You cannot use PC for any operand in any data processing instruction that has a register-controlled shift.

Condition flags

This instruction:

  • Updates the N and Z flags according to the result.
  • Can update the C flag during the calculation of Operand2.
  • Does not affect the V flag.

16-bit instructions

The following form of the TST instruction is available in T32 code, and is a 16-bit instruction:

TST Rn, Rm

Rn and Rm mustboth be Lo registers.

Architectures

This instruction is available A32 and T32.

Examples

    TST     r0, #0x3F8    TSTNE   r1, r5, ASR r1
Was this page helpful? Yes No