Introduction
FEAT_MOPS adds instructions that copy or fill a block of memory. One operation is three instructions in a row:
- the prologue, with
pin its name, prepares the registers and handles an implementation-defined part of the bytes; - the main instruction, with
m, does a further part; - the epilogue, with
e, finishes any bytes left.
The three are meant to appear consecutively in memory and to run in that order. The split between them is up to the processor, so that each design can use its best method. The registers are updated as the instruction goes, so an interrupt can stop the operation and it can carry on afterwards.
The registers are shown with writeback marks, as LLVM prints them:
- a copy is
cpyp [Xd]!, [Xs]!, Xn!: destination, source and byte count; - a set is
setp [Xd]!, Xn!, Xs: destination, byte count and the source of the value. The value is the low byte ofXs.
The registers must all be different, and the address registers may not be the zero register.
Architecturally there are two algorithms, option A and option B, and which one is used is implementation defined. The count register does not have the same meaning under each. Portable code runs the three instructions in sequence and does not depend on the values left in the registers in between.
The families are:
- cpy: a copy that works whichever way the source and destination overlap;
- cpyf: a copy that goes forwards only, for memory that does not overlap, or where the source address is greater than or equal to the destination address;
- set: fills memory with a byte;
- setg: fills memory and also sets Allocation Tags, used with memory tagging.
A suffix after the stage letter sets the access options. t means unprivileged and n means non-temporal. A leading w or r limits the option to writes or reads:
wt: writes unprivileged;rt: reads unprivileged;t: both;wn: writes non-temporal;rn: reads non-temporal;n: both;- an unprivileged option can be followed by a non-temporal one, such as
wtrn: writes unprivileged, reads non-temporal.
Only the prologue of each operation sets the condition flags. The main and epilogue instructions read them to see which option the prologue chose. The Flags columns below give NZCV for that reason.
The instructions
Each row is one complete operation with its three stages. All the names on a row have the same operands.
Copy (cpy)
| Mnemonic | Syntax | What it does | Flags |
|---|---|---|---|
cpyp, cpym, cpye | cpyp [Xd]!, [Xs]!, Xn! | Copy, with ordinary accesses. | NZCV (prologue only) |
cpypwt, cpymwt, cpyewt | cpypwt [Xd]!, [Xs]!, Xn! | Writes unprivileged. | NZCV (prologue only) |
cpyprt, cpymrt, cpyert | cpyprt [Xd]!, [Xs]!, Xn! | Reads unprivileged. | NZCV (prologue only) |
cpypt, cpymt, cpyet | cpypt [Xd]!, [Xs]!, Xn! | Reads and writes unprivileged. | NZCV (prologue only) |
cpypwn, cpymwn, cpyewn | cpypwn [Xd]!, [Xs]!, Xn! | Writes non-temporal. | NZCV (prologue only) |
cpyprn, cpymrn, cpyern | cpyprn [Xd]!, [Xs]!, Xn! | Reads non-temporal. | NZCV (prologue only) |
cpypn, cpymn, cpyen | cpypn [Xd]!, [Xs]!, Xn! | Reads and writes non-temporal. | NZCV (prologue only) |
cpypwtwn, cpymwtwn, cpyewtwn | cpypwtwn [Xd]!, [Xs]!, Xn! | Writes unprivileged and non-temporal. | NZCV (prologue only) |
cpypwtrn, cpymwtrn, cpyewtrn | cpypwtrn [Xd]!, [Xs]!, Xn! | Writes unprivileged, reads non-temporal. | NZCV (prologue only) |
cpypwtn, cpymwtn, cpyewtn | cpypwtn [Xd]!, [Xs]!, Xn! | Writes unprivileged, reads and writes non-temporal. | NZCV (prologue only) |
cpyprtwn, cpymrtwn, cpyertwn | cpyprtwn [Xd]!, [Xs]!, Xn! | Reads unprivileged, writes non-temporal. | NZCV (prologue only) |
cpyprtrn, cpymrtrn, cpyertrn | cpyprtrn [Xd]!, [Xs]!, Xn! | Reads unprivileged and non-temporal. | NZCV (prologue only) |
cpyprtn, cpymrtn, cpyertn | cpyprtn [Xd]!, [Xs]!, Xn! | Reads unprivileged, reads and writes non-temporal. | NZCV (prologue only) |
cpyptwn, cpymtwn, cpyetwn | cpyptwn [Xd]!, [Xs]!, Xn! | Reads and writes unprivileged, writes non-temporal. | NZCV (prologue only) |
cpyptrn, cpymtrn, cpyetrn | cpyptrn [Xd]!, [Xs]!, Xn! | Reads and writes unprivileged, reads non-temporal. | NZCV (prologue only) |
cpyptn, cpymtn, cpyetn | cpyptn [Xd]!, [Xs]!, Xn! | Reads and writes unprivileged and non-temporal. | NZCV (prologue only) |
Forward-only copy (cpyf)
| Mnemonic | Syntax | What it does | Flags |
|---|---|---|---|
cpyfp, cpyfm, cpyfe | cpyfp [Xd]!, [Xs]!, Xn! | Forward-only copy, with ordinary accesses. | NZCV (prologue only) |
cpyfpwt, cpyfmwt, cpyfewt | cpyfpwt [Xd]!, [Xs]!, Xn! | Writes unprivileged. | NZCV (prologue only) |
cpyfprt, cpyfmrt, cpyfert | cpyfprt [Xd]!, [Xs]!, Xn! | Reads unprivileged. | NZCV (prologue only) |
cpyfpt, cpyfmt, cpyfet | cpyfpt [Xd]!, [Xs]!, Xn! | Reads and writes unprivileged. | NZCV (prologue only) |
cpyfpwn, cpyfmwn, cpyfewn | cpyfpwn [Xd]!, [Xs]!, Xn! | Writes non-temporal. | NZCV (prologue only) |
cpyfprn, cpyfmrn, cpyfern | cpyfprn [Xd]!, [Xs]!, Xn! | Reads non-temporal. | NZCV (prologue only) |
cpyfpn, cpyfmn, cpyfen | cpyfpn [Xd]!, [Xs]!, Xn! | Reads and writes non-temporal. | NZCV (prologue only) |
cpyfpwtwn, cpyfmwtwn, cpyfewtwn | cpyfpwtwn [Xd]!, [Xs]!, Xn! | Writes unprivileged and non-temporal. | NZCV (prologue only) |
cpyfpwtrn, cpyfmwtrn, cpyfewtrn | cpyfpwtrn [Xd]!, [Xs]!, Xn! | Writes unprivileged, reads non-temporal. | NZCV (prologue only) |
cpyfpwtn, cpyfmwtn, cpyfewtn | cpyfpwtn [Xd]!, [Xs]!, Xn! | Writes unprivileged, reads and writes non-temporal. | NZCV (prologue only) |
cpyfprtwn, cpyfmrtwn, cpyfertwn | cpyfprtwn [Xd]!, [Xs]!, Xn! | Reads unprivileged, writes non-temporal. | NZCV (prologue only) |
cpyfprtrn, cpyfmrtrn, cpyfertrn | cpyfprtrn [Xd]!, [Xs]!, Xn! | Reads unprivileged and non-temporal. | NZCV (prologue only) |
cpyfprtn, cpyfmrtn, cpyfertn | cpyfprtn [Xd]!, [Xs]!, Xn! | Reads unprivileged, reads and writes non-temporal. | NZCV (prologue only) |
cpyfptwn, cpyfmtwn, cpyfetwn | cpyfptwn [Xd]!, [Xs]!, Xn! | Reads and writes unprivileged, writes non-temporal. | NZCV (prologue only) |
cpyfptrn, cpyfmtrn, cpyfetrn | cpyfptrn [Xd]!, [Xs]!, Xn! | Reads and writes unprivileged, reads non-temporal. | NZCV (prologue only) |
cpyfptn, cpyfmtn, cpyfetn | cpyfptn [Xd]!, [Xs]!, Xn! | Reads and writes unprivileged and non-temporal. | NZCV (prologue only) |
Set (set)
| Mnemonic | Syntax | What it does | Flags |
|---|---|---|---|
setp, setm, sete | setp [Xd]!, Xn!, Xs | Fills memory with the low byte of Xs. | NZCV (prologue only) |
setpt, setmt, setet | setpt [Xd]!, Xn!, Xs | Unprivileged. | NZCV (prologue only) |
setpn, setmn, seten | setpn [Xd]!, Xn!, Xs | Non-temporal. | NZCV (prologue only) |
setptn, setmtn, setetn | setptn [Xd]!, Xn!, Xs | Unprivileged and non-temporal. | NZCV (prologue only) |
Set with tags (setg)
These also store an Allocation Tag for each tag granule written, calculated from the Logical Address Tag in the address register.
| Mnemonic | Syntax | What it does | Flags |
|---|---|---|---|
setgp, setgm, setge | setgp [Xd]!, Xn!, Xs | Fills memory and sets tags. | NZCV (prologue only) |
setgpt, setgmt, setget | setgpt [Xd]!, Xn!, Xs | Unprivileged. | NZCV (prologue only) |
setgpn, setgmn, setgen | setgpn [Xd]!, Xn!, Xs | Non-temporal. | NZCV (prologue only) |
setgptn, setgmtn, setgetn | setgptn [Xd]!, Xn!, Xs | Unprivileged and non-temporal. | NZCV (prologue only) |
Links
Reference
- Arm A64 Instruction Set Architecture – Arm’s description of each A64 instruction
- Arm Architecture Reference Manual for A-profile – the full architecture specification