gmi

Get Memory Tag Intersection

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

Calculates a mask of excluded tags (MTE).

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
31
0
30
0
29
11010110
28:21
Xm
20:16
000101
15:10
Xn
9:5
Xd
4:0
 
Format Data Processing
Opcode 0x9AC01400

Operands

  • Xd
    Dest Mask
  • Xn
    Ptr
  • Xm
    Excluded

Related

More in MTE (Memory Tagging)

Reference

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;