Technical Support On-Line Manuals RealView Assembler User's Guide Preface Introduction Writing ARM Assembly Language Assembler Reference ARM and Thumb Instructions Instruction summary Memory access instructions Address alignment LDR and STR (immediate offset) LDR and STR (register offset) LDR and STR (User mode) LDR (pc-relative) ADR PLD, PLDW, and PLI LDM and STM PUSH and POP RFE SRS LDREX and STREX CLREX SWP and SWPB General data processing instructions Flexible second operand ADD, SUB, RSB, ADC, SBC, and RSC SUBS pc, lr AND, ORR, EOR, BIC, and ORN CLZ CMP and CMN MOV and MVN MOVT TST and TEQ SEL REV, REV16, REVSH, and RBIT ASR, LSL, LSR, ROR, and RRX SDIV and UDIV Multiply instructions MUL, MLA, and MLS UMULL, UMLAL, SMULL, and SMLAL SMULxy and SMLAxy SMULWy and SMLAWy SMLALxy SMUAD{X} and SMUSD{X} SMMUL, SMMLA, and SMMLS SMLAD and SMLSD SMLALD and SMLSLD UMAAL Saturating instructions Saturating arithmetic QADD, QSUB, QDADD, and QDSUB SSAT and USAT Parallel instructions Parallel add and subtract USAD8 and USADA8 SSAT16 and USAT16 Packing and unpacking instructions BFC and BFI SBFX and UBFX SXT, SXTA, UXT, and UXTA PKHBT and PKHTB Branch and control instructions B, BL, BX, BLX, and BXJ IT CBZ and CBNZ TBB and TBH Coprocessor instructions CDP and CDP2 MCR, MCR2, MCRR, and MCRR2 MRC, MRC2, MRRC and MRRC2 LDC, LDC2, STC, and STC2 Miscellaneous instructions BKPT SVC MRS MSR CPS SMC SETEND NOP, SEV, WFE, WFI, and YIELD DBG, DMB, DSB, and ISB Instruction width selection in Thumb Instruction width specifiers, .W and .N Different behavior for some instructions Diagnostic warning ThumbEE instructions ENTERX and LEAVEX CHKA HB, HBL, HBLP, and HBP Pseudo-instructions ADRL pseudo-instruction MOV32 pseudo-instruction LDR pseudo-instruction UND pseudo-instruction Directives Reference | TST and TEQTest bits and Test Equivalence.
TST{cond} Rn, Operand2
TEQ{cond} Rn, Operand2
where: condRnis the ARM register holding the first operand. Operand2
These instructions test the value in a register against Operand2. They update the condition flags on the result, but do not place the result in any register. The TST instruction performs a bitwise AND operation on the value in Rn and the value of Operand2. This is the same as an ANDS instruction, except that the result is discarded. The TEQ instruction performs a bitwise Exclusive OR operation on the value in Rn and the value of Operand2. This is the same as a EORS instruction, except that the result is discarded. Use the TEQ instruction to test if two values are equal, without affecting the V or C flags (as CMP does). TEQ is also useful for testing the sign of a value. After the comparison, the N flag is the logical Exclusive OR of the sign bits of the two operands.
For ARM 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 (see Flexible second operand).
For Thumb-2 instructions, you cannot use pc for Rn or in Operand2. These instructions: update the N and Z flags according to the result can update the C flag during the calculation of Operand2 (see Flexible second operand) do not affect the V flag.
The following form of the TST instruction is available in pre-Thumb-2 Thumb code, and is a 16-bit instruction when used in Thumb-2 code: TST Rn, RmRn and Rm must both be Lo registers.
These ARM instructions are available in all architectures with ARM. The TST Thumb instruction is available in all architectures with Thumb. The TEQ Thumb instruction is available in ARMv6T2 and above.
TST r0, #0x3F8
TEQEQ r10, r9
TSTNE r1, r5, ASR r1
TEQ pc, r1, ROR r0 ; pc not permitted with register
; controlled shift
|