PER ARM'S REQUEST, THIS SITE WILL BE DISCONTINUED ON 4 DECEMBER 2026. :(

Arm's lawyers have notified me to take down this site or face legal action.

To all of the fans of this site over the years (even the ones at Arm): thank you for your support! I'm glad I could provide a resource so many people found value in. I will look into solutions that can potentially keep bookmarks and links working.

— Jon

← Home

CNTP (predicate)

Set scalar to count of true predicate elements

This instruction determines the number of Active and true elements in the source predicate and places the scalar result in the destination general-purpose register. Inactive predicate elements are not counted.

SVE class

(FEAT_SVE || FEAT_SME)

313029282726252423222120191817161514131211109876543210
00100101size10000010Pg0PnRd
opc

Encoding

CNTP <Xd>, <Pg>, <Pn>.<T>

Decode

if !IsFeatureImplemented(FEAT_SVE) && !IsFeatureImplemented(FEAT_SME) then EndOfDecode(Decode_UNDEF); end; let esize : integer{} = 8 << UInt(size); let g : integer = UInt(Pg); let n : integer = UInt(Pn); let d : integer = UInt(Rd);

Assembler Symbols

<Xd>

Is the 64-bit name of the destination general-purpose register, encoded in the "Rd" field.

<Pg>

Is the name of the governing scalable predicate register, encoded in the "Pg" field.

<Pn>

Is the name of the source scalable predicate register, encoded in the "Pn" field.

<T>

Is the size specifier, encoded in size:

size <T>
00 B
01 H
10 S
11 D

Operation

CheckSVEEnabled(); let VL : integer{} = CurrentVL(); let PL : integer{} = VL DIV 8; let elements : integer = VL DIV esize; let mask : bits(PL) = P{}(g); let operand : bits(PL) = P{}(n); var sum : bits(64) = Zeros{}; for e = 0 to elements-1 do if (ActivePredicateElement{PL}(mask, e, esize) && ActivePredicateElement{PL}(operand, e, esize)) then sum = sum + 1; end; end; X{64}(d) = sum;

Operational information

If FEAT_SME is implemented and the PE is in Streaming SVE mode, then any subsequent instruction that is dependent on the general-purpose register written by this instruction might be significantly delayed.


Version 2026.09 — Copyright © 2010-2026 Arm Limited or its affiliates.

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