TST (register-shifted register)
Test (register-shifted register)
Test (register-shifted register) performs a bitwise AND operation on a register value and a register-shifted register value. It updates the condition flags based on the result, and discards the result.
For more information about the constrained unpredictable behavior of this instruction, see Architectural Constraints on UNPREDICTABLE behaviors.
If CPSR.DIT is 1, this instruction has passed its condition execution check, and does not use R15 as either its source or destination:
The execution time of this instruction is independent of:The values of the data supplied in any of its registers.The values of the NZCV flags.
The response of this instruction to asynchronous exceptions does not vary based on:The values of the data supplied in any of its registers.The values of the NZCV flags.
!= 1111
0
0
0
1
0
0
0
1
(0)
(0)
(0)
(0)
0
1
TST{<c>}{<q>} <Rn>, <Rm>, <type> <Rs>
n = UInt(Rn); m = UInt(Rm); s = UInt(Rs);
shift_t = DecodeRegShift(stype);
if n == 15 || m == 15 || s == 15 then UNPREDICTABLE;
<c>
See Standard assembler syntax fields.
<q>
See Standard assembler syntax fields.
<Rn>
Is the first general-purpose source register, encoded in the "Rn" field.
<Rm>
Is the second general-purpose source register, encoded in the "Rm" field.
<type>
Is the type of shift to be applied to the second source register,
stype
<type>
00
LSL
01
LSR
10
ASR
11
ROR
<Rs>
Is the third general-purpose source register holding a shift amount in its bottom 8 bits, encoded in the "Rs" field.
if ConditionPassed() then
EncodingSpecificOperations();
shift_n = UInt(R[s]<7:0>);
(shifted, carry) = Shift_C(R[m], shift_t, shift_n, PSTATE.C);
result = R[n] AND shifted;
PSTATE.N = result<31>;
PSTATE.Z = IsZeroBit(result);
PSTATE.C = carry;
// PSTATE.V unchanged