gmi

Get Memory Tag Intersection

GMI <Xd>, <Xn|SP>, <Xm>

Calculates a mask of excluded tags (MTE).

Details

Calculates the intersection of an Allocation Tag mask (tags excluded from Xm) with tags that are NOT present in the pointer Xn, returning a 16-bit mask of valid alternative tags in Xd. This instruction is only available in AArch64 and requires the MTE feature. No condition flags are affected.

Pseudocode Operation

ptr_tag ← (Xn >> 56) & 0xF
exclude_mask ← Xm & 0xFFFF
valid_tags ← ~exclude_mask & 0xFFFF
// Return mask of tags that are both valid (not excluded) and different from current tag
Xd ← valid_tags & ~(1 << ptr_tag)

Example

GMI x0, x1, x2

Encoding

Binary Layout
1
0
0
11010110
Xm
000101
Xn
Xd
 
Format Data Processing
Opcode 0x9AC01400
Extension MTE (Memory Tagging)

Operands

  • Xd
    Dest Mask
  • Xn
    Ptr
  • Xm
    Excluded

Reference (Arm A64 ISA)

Instruction Forms

Encoding Instruction ISA Bit pattern
0x9AC01400 GMI <Xd>, <Xn|SP>, <Xm> A64 1 | 0 | 0 | 11010110 | Xm | 000101 | Xn | Xd

Description

Tag Mask Insert inserts the tag in the first source register into the excluded set specified in the second source register, writing the new excluded set to the destination register.

Operation

bits(64) address = if n == 31 then SP[] else X[n, 64];
bits(64) mask = X[m, 64];
bits(4) tag = AArch64.AllocationTagFromAddress(address);

mask<UInt(tag)> = '1';
X[d, 64] = mask;