STG
Store Allocation Tag
This instruction stores an Allocation Tag to memory. The address used for
the store is calculated from the base register and an immediate signed
offset scaled by the Tag Granule. The Allocation Tag is calculated from the
Logical Address Tag in the source register.
This instruction generates an Unchecked access.
It has encodings from 3 classes:
Post-index
,
Pre-index
and
Signed offset
1
1
0
1
1
0
0
1
0
0
1
0
1
STG <Xt|SP>, [<Xn|SP>], #<simm>
if !IsFeatureImplemented(FEAT_MTE) then UNDEFINED;
constant integer t = UInt(Xt);
constant integer n = UInt(Xn);
constant bits(64) offset = LSL(SignExtend(imm9, 64), LOG2_TAG_GRANULE);
constant boolean writeback = TRUE;
constant boolean postindex = TRUE;
1
1
0
1
1
0
0
1
0
0
1
1
1
STG <Xt|SP>, [<Xn|SP>, #<simm>]!
if !IsFeatureImplemented(FEAT_MTE) then UNDEFINED;
constant integer t = UInt(Xt);
constant integer n = UInt(Xn);
constant bits(64) offset = LSL(SignExtend(imm9, 64), LOG2_TAG_GRANULE);
constant boolean writeback = TRUE;
constant boolean postindex = FALSE;
1
1
0
1
1
0
0
1
0
0
1
1
0
STG <Xt|SP>, [<Xn|SP>{, #<simm>}]
if !IsFeatureImplemented(FEAT_MTE) then UNDEFINED;
constant integer t = UInt(Xt);
constant integer n = UInt(Xn);
constant bits(64) offset = LSL(SignExtend(imm9, 64), LOG2_TAG_GRANULE);
constant boolean writeback = FALSE;
constant boolean postindex = FALSE;
<Xt|SP>
Is the 64-bit name of the general-purpose source register or stack pointer, encoded in the "Xt" field.
<Xn|SP>
Is the 64-bit name of the general-purpose base register or stack pointer, encoded in the "Xn" field.
<simm>
Is the optional signed immediate offset, a multiple of 16 in the range -4096 to 4080, defaulting to 0 and encoded in the "imm9" field.
bits(64) address;
if n == 31 then
CheckSPAlignment();
address = SP[];
else
address = X[n, 64];
constant boolean devstoreunpred = FALSE;
constant AccessDescriptor accdesc = CreateAccDescLDGSTG(MemOp_STORE, devstoreunpred);
if !postindex then
address = AddressAdd(address, offset, accdesc);
constant bits(64) data = if t == 31 then SP[] else X[t, 64];
constant bits(4) tag = AArch64.AllocationTagFromAddress(data);
AArch64.MemTag[address, accdesc] = tag;
if writeback then
if postindex then
address = AddressAdd(address, offset, accdesc);
if n == 31 then
SP[] = address;
else
X[n, 64] = address;