umaxv
SVE Unsigned Maximum Reduction
UMAXV <Vd>, <Pg>, <Zn>.<T>
Finds max unsigned element in vector.
Pseudocode Operation
bits(esize) result = 0;
for i = 0 to VL/esize - 1
if Pg[i] == '1' then
element = Zn[i*esize +: esize];
if element > result (unsigned) then result = element;
Vd[0 +: esize] ← result;
Example
UMAXV v0.4s, p0/m, z1.s.T
Encoding
Binary Layout
00000100
31:24
size
23:22
0010
21:18
0
17
1
16
001
15:13
Pg
12:10
Zn
9:5
Vd
4:0
Operands
-
Vd
Dest Scalar -
Pg
Mask -
Zn
Vector
Related
More in SVE
Reference
View in Arm A64 ISA Reference ↗
Arm A64 ISA
Instruction Forms
| Encoding | Instruction | ISA | Bit pattern | ||
|---|---|---|---|---|---|
| 0x2E30A800 | UMAXV <V><d>, <Vn>.<T> | A64 | 0 | Q | 1 | 01110 | size | 11000 | 0 | 101010 | Rn | Rd | ||
| 0x04092000 | UMAXV <V><d>, <Pg>, <Zn>.<T> | A64 | 00000100 | size | 0010 | 0 | 1 | 001 | Pg | Zn | Vd |
Description
Unsigned maximum horizontally across all lanes of a vector, and place the result in the SIMD&FP scalar destination register. Inactive elements in the source vector are treated as zero.
Operation
CheckSVEEnabled();
constant integer VL = CurrentVL;
constant integer PL = VL DIV 8;
constant integer elements = VL DIV esize;
bits(PL) mask = P[g, PL];
bits(VL) operand = if AnyActiveElement(mask, esize) then Z[n, VL] else Zeros(VL);
integer maximum = if unsigned then 0 else -(2^(esize-1));
for e = 0 to elements-1
if ActivePredicateElement(mask, e, esize) then
integer element = Int(Elem[operand, e, esize], unsigned);
maximum = Max(maximum, element);
V[d, esize] = maximum<esize-1:0>;