Memory Set with tag setting. These instructions perform a memory set using the value in the bottom byte of the source register. The prologue, main, and epilogue instructions are expected to be run in succession and to appear consecutively in memory: SETGP, then SETGM, and then SETGE.
SETGP performs some preconditioning of the arguments suitable for using the SETGM instruction, and performs an implementation defined amount of the memory set. SETGM performs an implementation defined amount of the memory set. SETGE performs the last part of the memory set.
The inclusion of implementation defined amounts of memory set allows some optimization of the size that can be performed.
The architecture supports two algorithms for the memory set: option A and option B. Which algorithm is used is implementation defined.
Portable software should not assume that the choice of algorithm is constant.
After execution of SETGP, option A (which results in encoding PSTATE.C = 0):
After execution of SETGP, option B (which results in encoding PSTATE.C = 1):
For SETGM, option A (encoded by PSTATE.C = 0), the format of the arguments is:
For SETGM, option B (encoded by PSTATE.C = 1), the format of the arguments is:
For SETGE, option A (encoded by PSTATE.C = 0), the format of the arguments is:
For SETGE, option B (encoded by PSTATE.C = 1), the format of the arguments is:
31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
sz | 0 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 0 | Rs | x | x | 0 | 0 | 0 | 1 | Rn | Rd | |||||||||||||
op2 |
if !HaveFeatMOPS() then UNDEFINED; if !HaveMTEExt() then UNDEFINED; if sz != '00' then UNDEFINED; integer d = UInt(Rd); integer s = UInt(Rs); integer n = UInt(Rn); bits(2) options = op2<1:0>; MOPSStage stage; case op2<3:2> of when '00' stage = MOPSStage_Prologue; when '01' stage = MOPSStage_Main; when '10' stage = MOPSStage_Epilogue; otherwise UNDEFINED; if s == n || s == d || n == d then UNDEFINED; if d == 31 || n == 31 then UNDEFINED;
CheckMOPSEnabled(); bits(64) toaddress = X[d]; bits(64) setsize = X[n]; bits(8) data = X[s]; bits(64) stagesetsize; boolean is_setg = TRUE; integer B; if HaveMTE2Ext() then SetTagCheckedInstruction(FALSE); boolean supports_option_a = MemCpyOptionA(); acctype = MemSetAccessType(options); if stage == MOPSStage_Prologue then if setsize<63> == '1' then setsize = 0x7FFFFFFFFFFFFFF0<63:0>; if setsize != Zeros(64) && toaddress != Align(toaddress, TAG_GRANULE) then boolean iswrite = TRUE; boolean secondstage = FALSE; AArch64.Abort(toaddress, AlignmentFault(acctype, iswrite, secondstage)); if setsize != Align(setsize, TAG_GRANULE) then boolean iswrite = TRUE; boolean secondstage = FALSE; AArch64.Abort(toaddress, AlignmentFault(acctype, iswrite, secondstage)); if supports_option_a then PSTATE.C = '0'; toaddress = toaddress + setsize; setsize = Zeros(64) - setsize; else PSTATE.C = '1'; PSTATE.N = '0'; PSTATE.V = '0'; PSTATE.Z = '0'; stagesetsize = SETPreSizeChoice(toaddress, setsize, is_setg); assert stagesetsize<63> == setsize<63> || stagesetsize == Zeros(); assert stagesetsize<3:0> == '0000'; if SInt(setsize) > 0 then assert SInt(stagesetsize) <= SInt(setsize); else assert SInt(stagesetsize) >= SInt(setsize); else bits(64) postsize = SETPostSizeChoice(toaddress, setsize, is_setg); assert postsize<63> == setsize<63> || postsize == Zeros(); assert postsize<3:0> == '0000'; boolean zero_size_exceptions = MemSetZeroSizeCheck(); // Check if this version is consistent with the state of the call. if zero_size_exceptions || SInt(setsize) != 0 then if supports_option_a then if PSTATE.C == '1' then boolean wrong_option = TRUE; boolean from_epilogue = stage == MOPSStage_Epilogue; MismatchedMemSetException(supports_option_a, d, s, n, wrong_option, from_epilogue, options, is_setg); else if PSTATE.C == '0' then boolean wrong_option = TRUE; boolean from_epilogue = stage == MOPSStage_Epilogue; MismatchedMemSetException(supports_option_a, d, s, n, wrong_option, from_epilogue, options, is_setg); if stage == MOPSStage_Main then stagesetsize = setsize - postsize; if MemSetParametersIllformedM(toaddress, setsize, is_setg) then boolean wrong_option = FALSE; boolean from_epilogue = FALSE; MismatchedMemSetException(supports_option_a, d, s, n, wrong_option, from_epilogue, options, is_setg); else stagesetsize = postsize; if (setsize != postsize || MemSetParametersIllformedE(toaddress, setsize, is_setg)) then boolean wrong_option = FALSE; boolean from_epilogue = TRUE; MismatchedMemSetException(supports_option_a, d, s, n, wrong_option, from_epilogue, options, is_setg); if setsize != Zeros(64) && toaddress != Align(toaddress, TAG_GRANULE) then boolean iswrite = TRUE; boolean secondstage = FALSE; AArch64.Abort(toaddress, AlignmentFault(acctype, iswrite, secondstage)); if setsize != Align(setsize, TAG_GRANULE) then boolean iswrite = TRUE; boolean secondstage = FALSE; AArch64.Abort(toaddress, AlignmentFault(acctype, iswrite, secondstage)); integer tagstep; bits(4) tag; bits(64) tagaddr; if supports_option_a then while SInt(stagesetsize) < 0 do // IMP DEF selection of the block size that is worked on. While many // implementations might make this constant, that is not assumed. B = SETSizeChoice(toaddress, setsize, 16); assert B <= -1*SInt(stagesetsize); assert B<3:0> == '0000'; Mem[toaddress + setsize, B, acctype] = Replicate(data, B); tagstep = B DIV 16; tag = AArch64.AllocationTagFromAddress(toaddress + setsize); while tagstep > 0 do tagaddr = toaddress + setsize + (tagstep-1) * 16; AArch64.MemTag[tagaddr, acctype] = tag; tagstep = tagstep - 1; setsize = setsize + B; stagesetsize = stagesetsize + B; if stage != MOPSStage_Prologue then X[n] = setsize; else while UInt(stagesetsize) > 0 do // IMP DEF selection of the block size that is worked on. While many // implementations might make this constant, that is not assumed. B = SETSizeChoice(toaddress, setsize, 16); assert B <= UInt(stagesetsize); assert B<3:0> == '0000'; Mem[toaddress, B, acctype] = Replicate(data, B); tagstep = B DIV 16; tag = AArch64.AllocationTagFromAddress(toaddress); while tagstep > 0 do tagaddr = toaddress + (tagstep-1) * 16; AArch64.MemTag[tagaddr, acctype] = tag; tagstep = tagstep - 1; toaddress = toaddress + B; setsize = setsize - B; stagesetsize = stagesetsize - B; if stage != MOPSStage_Prologue then X[n] = setsize; X[d] = toaddress; if stage == MOPSStage_Prologue then X[n] = setsize; X[d] = toaddress;
Internal version only: isa v33.11seprel, AdvSIMD v29.05, pseudocode v2021-09_rel, sve v2021-09_rc3d ; Build timestamp: 2021-10-06T11:41
Copyright © 2010-2021 Arm Limited or its affiliates. All rights reserved. This document is Non-Confidential.