cpy
SVE Copy from SIMD&FP Scalar (Predicated)
CPY <Zd>.<T>, <Pg>/M, <V><n>
Copies a SIMD&FP scalar register into the active elements of a vector, leaving the rest.
Pseudocode Operation
src = V[n] (esize bits) if any element of Pg is active, else 0
for e = 0 to elements - 1
if Pg is active for element e
Zd[e] = src
// an inactive element of Zd is unchanged
Example
CPY Z0.S, P0/M, S1
Encoding
Binary Layout
00000101
31:24
size
23:22
100000100
21:13
Pg
12:10
Vn
9:5
Zd
4:0
Operands
-
Zd
Destination scalable vector register -
Pg
Governing predicate register, P0 to P7 -
Vn
Source SIMD&FP scalar register, B, H, S or D as the element size says
Reference
View in Arm A64 ISA Reference ↗
Arm A64 ISA
Instruction Forms
| Encoding | Instruction | ISA | Bit pattern |
|---|---|---|---|
| 0x05100000 | CPY <Zd>.<T>, <Pg>/Z, #<imm>{, <shift>} | A64 | 00000101 | size | 01 | Pg | 0 | 0 | sh | imm8 | Zd |
| 0x05104000 | CPY <Zd>.<T>, <Pg>/M, #<imm>{, <shift>} | A64 | 00000101 | size | 01 | Pg | 0 | 1 | sh | imm8 | Zd |
| 0x0528A000 | CPY <Zd>.<T>, <Pg>/M, <R><n|SP> | A64 | 00000101 | size | 101000101 | Pg | Rn | Zd |
| 0x05208000 | CPY <Zd>.<T>, <Pg>/M, <V><n> | A64 | 00000101 | size | 100000100 | Pg | Vn | Zd |
Description
Copy the SIMD & floating-point scalar source register to each active element in the destination vector. Inactive elements in the destination vector register remain unmodified.
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(esize) operand1 = if AnyActiveElement(mask, esize) then V[n, esize] else Zeros(esize);
bits(VL) result = Z[d, VL];
for e = 0 to elements-1
if ActivePredicateElement(mask, e, esize) then
Elem[result, e, esize] = operand1;
Z[d, VL] = result;