← Home

CTERMEQ, CTERMNE

Compare and terminate loop

This instruction detects termination conditions in serialized vector loops by testing whether the comparison between the scalar source operands holds true. If the comparison is not successful, the instruction tests the state of the !Last condition flag (C), which indicates whether the previous flag-setting predicate instruction selected the last element of the vector partition.

The Z and C condition flags are preserved by this instruction. The N and V condition flags are set as a pair to generate one of the following conditions for a subsequent conditional instruction:

Condition N V Meaning
GE 0 0 Continue loop (compare failed and last element not selected)
LT 0 1 Terminate loop (last element selected)
LT 1 0 Terminate loop (compare succeeded)
GE 1 1 Never generated

The scalar source operands are 32-bit or 64-bit general-purpose registers of the same size.

It has encodings from 2 classes: Equal and Not equal

Equal class

(FEAT_SVE || FEAT_SME)

313029282726252423222120191817161514131211109876543210
001001011sz1Rm001000Rn00000
opne

Encoding

CTERMEQ <R><n>, <R><m>

Decode

if !IsFeatureImplemented(FEAT_SVE) && !IsFeatureImplemented(FEAT_SME) then EndOfDecode(Decode_UNDEF); constant integer esize = 32 << UInt(sz); constant integer n = UInt(Rn); constant integer m = UInt(Rm); constant CmpOp cmp_op = Cmp_EQ;

Not equal class

(FEAT_SVE || FEAT_SME)

313029282726252423222120191817161514131211109876543210
001001011sz1Rm001000Rn10000
opne

Encoding

CTERMNE <R><n>, <R><m>

Decode

if !IsFeatureImplemented(FEAT_SVE) && !IsFeatureImplemented(FEAT_SME) then EndOfDecode(Decode_UNDEF); constant integer esize = 32 << UInt(sz); constant integer n = UInt(Rn); constant integer m = UInt(Rm); constant CmpOp cmp_op = Cmp_NE;

Assembler Symbols

<R>

Is a width specifier, encoded in sz:

sz <R>
0 W
1 X
<n>

Is the number [0-30] of the source general-purpose register or the name ZR (31), encoded in the "Rn" field.

<m>

Is the number [0-30] of the source general-purpose register or the name ZR (31), encoded in the "Rm" field.

Operation

CheckSVEEnabled(); constant bits(esize) operand1 = X[n, esize]; constant bits(esize) operand2 = X[m, esize]; constant integer element1 = UInt(operand1); constant integer element2 = UInt(operand2); boolean term; case cmp_op of when Cmp_EQ term = element1 == element2; when Cmp_NE term = element1 != element2; if term then PSTATE.N = '1'; PSTATE.V = '0'; else PSTATE.N = '0'; PSTATE.V = (NOT PSTATE.C);

Operational information

This instruction is a data-independent-time instruction as described in About PSTATE.DIT.


Version 2025.09 — Copyright © 2010-2025 Arm Limited or its affiliates.

This site is provided as a community resource and is NOT affiliated with nor endorsed by Arm Limited.