teq
Test Equivalence (A32)
TEQ<c> <Rn>, <Operand2>
Bitwise Exclusive OR and update flags (discard result).
Details
Performs a bitwise exclusive OR of Rn and Operand2, updates the condition flags based on the result, and discards the result. The N flag is set if bit 31 of the result is 1; Z is set if the result is 0; C is affected by the shifter (if applicable); V is unchanged. This instruction is useful for testing equality of two values.
Pseudocode Operation
result ← Rn XOR Operand2
N ← result[31]
Z ← (result == 0)
C ← shifter_carry_out
V ← V // Unchanged
Example
TEQ r1, r2
Encoding
Binary Layout
cond
00110
01
1
Rn
0
0
0
0
imm12
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 (immediate) performs a bitwise exclusive OR operation on a register value and an immediate value. It updates the condition flags based on the result, and discards the result.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
result = R[n] EOR imm32;
PSTATE.N = result<31>;
PSTATE.Z = IsZeroBit(result);
PSTATE.C = carry;
// PSTATE.V unchanged