ld1h

SVE Load Contiguous Halfwords

LD1H { <Zt>.H }, <Pg>/Z, [<Xn|SP>]

Loads halfwords from memory into a vector under predicate control.

Details

Loads contiguous halfwords from memory into a SVE vector register under predicate control. Each active predicate element loads one 16-bit value from the address sequence [Xn|SP + 2*i], zero-extending to fill the halfword element. Inactive elements are zeroed (Z suffix semantics). No flags are affected.

Pseudocode Operation

for i = 0 to VL/16-1
  if Pg[i] == 1 then
    Zt.H[i] ← [Xn + 2*i]
  else
    Zt.H[i] ← 0

Example

LD1H p0/m/Z, [x1]

Encoding

Binary Layout
1010010
010
1
0
imm4
101
Pg
Rn
Zt
 
Format SVE Load
Opcode 0xA4A0A000
Extension SVE

Operands

  • Zt
    Dest Vector
  • Pg
    Predicate
  • Xn
    Base Addr

Reference (Arm A64 ISA)

Instruction Forms

Encoding Instruction ISA Bit pattern
0xA0402000 LD1H { <Zt1>.H-<Zt2>.H }, <PNg>/Z, [<Xn|SP>{, #<imm>, MUL VL}] A64 101000000100 | imm4 | 0 | 0 | 1 | PNg | Rn | Zt | 0
0xA040A000 LD1H { <Zt1>.H-<Zt4>.H }, <PNg>/Z, [<Xn|SP>{, #<imm>, MUL VL}] A64 101000000100 | imm4 | 1 | 0 | 1 | PNg | Rn | Zt | 0 | 0
0xA0002000 LD1H { <Zt1>.H-<Zt2>.H }, <PNg>/Z, [<Xn|SP>, <Xm>, LSL #1] A64 10100000000 | Rm | 0 | 0 | 1 | PNg | Rn | Zt | 0
0xA000A000 LD1H { <Zt1>.H-<Zt4>.H }, <PNg>/Z, [<Xn|SP>, <Xm>, LSL #1] A64 10100000000 | Rm | 1 | 0 | 1 | PNg | Rn | Zt | 0 | 0
0xA1402000 LD1H { <Zt1>.H, <Zt2>.H }, <PNg>/Z, [<Xn|SP>{, #<imm>, MUL VL}] A64 101000010100 | imm4 | 0 | 0 | 1 | PNg | Rn | T | 0 | Zt
0xA140A000 LD1H { <Zt1>.H, <Zt2>.H, <Zt3>.H, <Zt4>.H }, <PNg>/Z, [<Xn|SP>{, #<imm>, MUL VL}] A64 101000010100 | imm4 | 1 | 0 | 1 | PNg | Rn | T | 0 | 0 | Zt
0xA1002000 LD1H { <Zt1>.H, <Zt2>.H }, <PNg>/Z, [<Xn|SP>, <Xm>, LSL #1] A64 10100001000 | Rm | 0 | 0 | 1 | PNg | Rn | T | 0 | Zt
0xA100A000 LD1H { <Zt1>.H, <Zt2>.H, <Zt3>.H, <Zt4>.H }, <PNg>/Z, [<Xn|SP>, <Xm>, LSL #1] A64 10100001000 | Rm | 1 | 0 | 1 | PNg | Rn | T | 0 | 0 | Zt
0x84A0C000 LD1H { <Zt>.S }, <Pg>/Z, [<Zn>.S{, #<imm>}] A64 1000010 | 0 | 1 | 01 | imm5 | 1 | 1 | 0 | Pg | Zn | Zt
0xC4A0C000 LD1H { <Zt>.D }, <Pg>/Z, [<Zn>.D{, #<imm>}] A64 1100010 | 0 | 1 | 01 | imm5 | 1 | 1 | 0 | Pg | Zn | Zt
0xA4A0A000 LD1H { <Zt>.H }, <Pg>/Z, [<Xn|SP>{, #<imm>, MUL VL}] A64 1010010 | 010 | 1 | 0 | imm4 | 101 | Pg | Rn | Zt
0xA4C0A000 LD1H { <Zt>.S }, <Pg>/Z, [<Xn|SP>{, #<imm>, MUL VL}] A64 1010010 | 011 | 0 | 0 | imm4 | 101 | Pg | Rn | Zt
0xA4E0A000 LD1H { <Zt>.D }, <Pg>/Z, [<Xn|SP>{, #<imm>, MUL VL}] A64 1010010 | 011 | 1 | 0 | imm4 | 101 | Pg | Rn | Zt
0xA4A04000 LD1H { <Zt>.H }, <Pg>/Z, [<Xn|SP>, <Xm>, LSL #1] A64 1010010 | 010 | 1 | Rm | 010 | Pg | Rn | Zt

Description

Contiguous load of unsigned halfwords to elements of a vector register from the memory address generated by a 64-bit scalar base and immediate index in the range -8 to 7 which is multiplied by the vector's in-memory size, irrespective of predication, and added to the base address. Inactive elements will not cause a read from Device memory or signal a fault, and are set to zero in the destination vector.

Operation

CheckSVEEnabled();
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(msize) data;
constant integer mbytes = msize DIV 8;
boolean contiguous = TRUE;
boolean nontemporal = FALSE;
boolean tagchecked = n != 31;
AccessDescriptor accdesc = CreateAccDescSVE(MemOp_LOAD, nontemporal, 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];

for e = 0 to elements-1
    if ActivePredicateElement(mask, e, esize) then
        integer eoff = (offset * elements) + e;
        bits(64) addr = GenerateAddress(base, eoff * mbytes, accdesc);
        data = Mem[addr, mbytes, accdesc];
        Elem[result, e, esize] = Extend(data, esize, unsigned);
    else
        Elem[result, e, esize] = Zeros(esize);

Z[t, VL] = result;