ldff1h
SVE Load First-Fault Contiguous Halfwords
LDFF1H { <Zt>.H }, <Pg>/Z, [<Xn|SP>]
Loads halfwords speculatively; suppresses faults after the first active element.
Details
Loads halfwords from memory into a scalable vector register with first-fault semantics; subsequent faults are suppressed if any active element has already been loaded. Only elements where the predicate is true are loaded. This instruction is AArch64-only and requires SVE. No condition flags are set.
Pseudocode Operation
for i ← 0 to (VL/16 - 1) do if Pg[i] then Zt[i*16+15:i*16] ← [Xn + i*2]; faulted ← false; end if; if fault_occurs and faulted then suppress_fault; faulted ← true; end if; end for
Example
LDFF1H p0/m/Z, [x1]
Encoding
Binary Layout
1010010
010
1
Rm
011
Pg
Rn
Zt
Operands
-
Zt
Transfer scalable vector register (SVE load/store) -
Pg
Predicate -
Xn
First source / base 64-bit integer register
Reference (Arm A64 ISA)
Instruction Forms
| Encoding | Instruction | ISA | Bit pattern | ||
|---|---|---|---|---|---|
| 0x84A0E000 | LDFF1H { <Zt>.S }, <Pg>/Z, [<Zn>.S{, #<imm>}] | A64 | 1000010 | 0 | 1 | 01 | imm5 | 1 | 1 | 1 | Pg | Zn | Zt | ||
| 0xC4A0E000 | LDFF1H { <Zt>.D }, <Pg>/Z, [<Zn>.D{, #<imm>}] | A64 | 1100010 | 0 | 1 | 01 | imm5 | 1 | 1 | 1 | Pg | Zn | Zt | ||
| 0xA4A06000 | LDFF1H { <Zt>.H }, <Pg>/Z, [<Xn|SP>{, <Xm>, LSL #1}] | A64 | 1010010 | 010 | 1 | Rm | 011 | Pg | Rn | Zt | ||
| 0xA4C06000 | LDFF1H { <Zt>.S }, <Pg>/Z, [<Xn|SP>{, <Xm>, LSL #1}] | A64 | 1010010 | 011 | 0 | Rm | 011 | Pg | Rn | Zt | ||
| 0xA4E06000 | LDFF1H { <Zt>.D }, <Pg>/Z, [<Xn|SP>{, <Xm>, LSL #1}] | A64 | 1010010 | 011 | 1 | Rm | 011 | Pg | Rn | Zt | ||
| 0x84A06000 | LDFF1H { <Zt>.S }, <Pg>/Z, [<Xn|SP>, <Zm>.S, <mod> #1] | A64 | 100001001 | xs | 1 | Zm | 0 | 1 | 1 | Pg | Rn | Zt | ||
| 0xC4A06000 | LDFF1H { <Zt>.D }, <Pg>/Z, [<Xn|SP>, <Zm>.D, <mod> #1] | A64 | 1100010 | 0 | 1 | xs | 1 | Zm | 0 | 1 | 1 | Pg | Rn | Zt | ||
| 0xC4806000 | LDFF1H { <Zt>.D }, <Pg>/Z, [<Xn|SP>, <Zm>.D, <mod>] | A64 | 1100010 | 0 | 1 | xs | 0 | Zm | 0 | 1 | 1 | Pg | Rn | Zt | ||
| 0x84806000 | LDFF1H { <Zt>.S }, <Pg>/Z, [<Xn|SP>, <Zm>.S, <mod>] | A64 | 1000010 | 0 | 1 | xs | 0 | Zm | 0 | 1 | 1 | Pg | Rn | Zt | ||
| 0xC4E0E000 | LDFF1H { <Zt>.D }, <Pg>/Z, [<Xn|SP>, <Zm>.D, LSL #1] | A64 | 1100010 | 0 | 1 | 11 | Zm | 1 | 1 | 1 | Pg | Rn | Zt | ||
| 0xC4C0E000 | LDFF1H { <Zt>.D }, <Pg>/Z, [<Xn|SP>, <Zm>.D] | A64 | 1100010 | 0 | 1 | 10 | Zm | 1 | 1 | 1 | Pg | Rn | Zt |
Description
Contiguous load with first-faulting behavior of unsigned halfwords to elements of a vector register from the memory address generated by a 64-bit scalar base and scalar index which is multiplied by 2 and added to the base address. After each element access the index value is incremented, but the index register is not updated. Inactive elements will not cause a read from Device memory or signal a fault, and are set to zero in the destination vector.
This instruction is illegal when executed in Streaming SVE mode, unless FEAT_SME_FA64 is implemented and enabled.
Operation
CheckNonStreamingSVEEnabled();
constant integer VL = CurrentVL;
constant integer PL = VL DIV 8;
constant integer elements = VL DIV esize;
bits(64) base;
bits(PL) mask = P[g, PL];
bits(VL) result;
bits(VL) orig = Z[t, VL];
bits(msize) data;
bits(64) offset;
constant integer mbytes = msize DIV 8;
boolean fault = FALSE;
boolean faulted = FALSE;
boolean unknown = FALSE;
boolean contiguous = TRUE;
boolean tagchecked = TRUE;
AccessDescriptor accdesc = CreateAccDescSVEFF(contiguous, tagchecked);
if !AnyActiveElement(mask, esize) then
if n == 31 && ConstrainUnpredictableBool(Unpredictable_CHECKSPNONEACTIVE) then
CheckSPAlignment();
else
if n == 31 then CheckSPAlignment();
base = if n == 31 then SP[] else X[n, 64];
offset = X[m, 64];
assert accdesc.first;
for e = 0 to elements-1
if ActivePredicateElement(mask, e, esize) then
integer eoff = UInt(offset) + e;
bits(64) addr = GenerateAddress(base, eoff * mbytes, accdesc);
if accdesc.first then
// Mem[] will not return if a fault is detected for the first active element
data = Mem[addr, mbytes, accdesc];
accdesc.first = FALSE;
else
// MemNF[] will return fault=TRUE if access is not performed for any reason
(data, fault) = MemNF[addr, mbytes, accdesc];
else
(data, fault) = (Zeros(msize), FALSE);
// FFR elements set to FALSE following a suppressed access/fault
faulted = faulted || fault;
if faulted then
ElemFFR[e, esize] = '0';
// Value becomes CONSTRAINED UNPREDICTABLE after an FFR element is FALSE
unknown = unknown || ElemFFR[e, esize] == '0';
if unknown then
if !fault && ConstrainUnpredictableBool(Unpredictable_SVELDNFDATA) then
Elem[result, e, esize] = Extend(data, esize, unsigned);
elsif ConstrainUnpredictableBool(Unpredictable_SVELDNFZERO) then
Elem[result, e, esize] = Zeros(esize);
else // merge
Elem[result, e, esize] = Elem[orig, e, esize];
else
Elem[result, e, esize] = Extend(data, esize, unsigned);
Z[t, VL] = result;