teq.w

Test Equivalence (Wide)

TEQ.W <Rn>, <Operand2>

Thumb-2 32-bit Test Equivalence (XOR and update flags).

Details

Test Equivalence (XOR and update flags): computes the bitwise XOR of Rn and Operand2, updating the N and Z flags based on the result without writing to a destination register. C is updated by the shifter; V is unaffected. This is a Thumb-2 (32-bit) instruction available in T32 execution state.

Pseudocode Operation

result ← Rn XOR Operand2
N ← result[31]
Z ← (result == 0)
C ← CarryOut(Operand2)
V ← unchanged

Example

TEQ.W r1, r2

Encoding

Binary Layout
1110101
0100
1
Rn
0
imm3
1111
imm2
stype
Rm
 
Format Thumb2 Data Proc
Opcode 0xEA900F00
Extension T32 (Thumb2)

Operands

  • Rn
    First source / base general-purpose register
  • Operand2
    Flexible second operand (register or shifted register)

Reference (Arm AArch32 ISA)

Instruction Forms

Encoding Instruction ISA Bit pattern
0x03300000 TEQ{<c>}{<q>} <Rn>, #<const> A32 cond | 00110 | 01 | 1 | Rn | 0 | 0 | 0 | 0 | imm12
0xF0900F00 TEQ{<c>}{<q>} <Rn>, #<const> T32 11110 | i | 0 | 0100 | 1 | Rn | 0 | imm3 | 1111 | imm8
0x01300060 TEQ{<c>}{<q>} <Rn>, <Rm>, RRX A32 cond | 00010 | 01 | 1 | Rn | 0 | 0 | 0 | 0 | 00000 | 11 | 0 | Rm
0x01300000 TEQ{<c>}{<q>} <Rn>, <Rm> {, <shift> #<amount>} A32 cond | 00010 | 01 | 1 | Rn | 0 | 0 | 0 | 0 | imm5 | stype | 0 | Rm
0xEA900F30 TEQ{<c>}{<q>} <Rn>, <Rm>, RRX T32 1110101 | 0100 | 1 | Rn | 0 | 000 | 1111 | 00 | 11 | Rm
0xEA900F00 TEQ{<c>}{<q>} <Rn>, <Rm> {, <shift> #<amount>} T32 1110101 | 0100 | 1 | Rn | 0 | imm3 | 1111 | imm2 | stype | Rm
0x01300010 TEQ{<c>}{<q>} <Rn>, <Rm>, <type> <Rs> A32 cond | 00010 | 01 | 1 | Rn | 0 | 0 | 0 | 0 | Rs | 0 | stype | 1 | Rm

Description

Test Equivalence (register) performs a bitwise exclusive-OR operation on a register value and an optionally-shifted register value. It updates the condition flags based on the result, and discards the result.

Operation

if ConditionPassed() then
    EncodingSpecificOperations();
    (shifted, carry) = Shift_C(R[m], shift_t, shift_n, PSTATE.C);
    result = R[n] EOR shifted;
    PSTATE.N = result<31>;
    PSTATE.Z = IsZeroBit(result);
    PSTATE.C = carry;
    // PSTATE.V unchanged