diff options
author | David Faust <david.faust@oracle.com> | 2023-07-24 14:50:34 -0700 |
---|---|---|
committer | David Faust <david.faust@oracle.com> | 2023-07-25 13:40:06 -0700 |
commit | 02f68ef297b8d4b51829e850da0ec898e529372f (patch) | |
tree | 9121a3515ee517e64eadab2d11946d2e6e15ff7e /gas/doc | |
parent | 055a4c8e0f100bbca2ff7cd6fb423dece561a8cd (diff) | |
download | gdb-02f68ef297b8d4b51829e850da0ec898e529372f.zip gdb-02f68ef297b8d4b51829e850da0ec898e529372f.tar.gz gdb-02f68ef297b8d4b51829e850da0ec898e529372f.tar.bz2 |
bpf: Add atomic compare-and-exchange instructions
This patch adds the two remaining BPF v3 atomic instructions:
- BPF_INSN_ACMP{,32}: atomic compare-and-swap
- BPF_INSN_AXCHG{,32}: atomic (non-conditional) exchange
Tests and documentation are also updated.
gas/
* doc/c-bpf.texi (BPF Instructions): Document atomic exchange and
atomic compare-and-swap instructions.
* testsuite/gas/bpf/atomic.s: Test ACMP, ACMP32, AXCHG, AXCGH32
instructions.
* testsuite/gas/bpf/atomic.d: Likewise.
* testsuite/gas/bpf/atomic-be.d: Likewise.
* testsuite/gas/bpf/atomic-pseudoc.s: Likewise.
* testsuite/gas/bpf/atomic-pseudoc.d: Likewise.
* testsuite/gas/bpf/atomic-be-pseudoc.d: Likewise.
include/
* opcode/bpf.h (BPF_IMM32_ACMP): Fix typo.
(enum bpf_insn_id): New entries for BPF_INSN_ACMP{,32} and
BPF_INSN_AXCHG{,32}.
opcodes/
* bpf-opc.c (bpf_opcodes): Add entries for ACMP{,32} and
AXCHG{,32} instructions.
Diffstat (limited to 'gas/doc')
-rw-r--r-- | gas/doc/c-bpf.texi | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/gas/doc/c-bpf.texi b/gas/doc/c-bpf.texi index 689786e..8f39ab3 100644 --- a/gas/doc/c-bpf.texi +++ b/gas/doc/c-bpf.texi @@ -745,8 +745,26 @@ Jump if signed lesser or equal. @subsection Atomic instructions -Atomic exchange-and-add instructions are provided in two flavors: one -for swapping 64-bit quantities and another for 32-bit quantities. +Atomic exchange instructions are provided in two flavors: one for +compare-and-swap, one for unconditional exchange. + +@table @code +@item acmp [rd + offset16], rs +@itemx r0 = cmpxchg_64 (rd + offset16, r0, rs) +Atomic compare-and-swap. Compares value in @code{r0} to value +addressed by @code{rd + offset16}. On match, the value addressed by +@code{rd + offset16} is replaced with the value in @code{rs}. +Regardless, the value that was at @code{rd + offset16} is +zero-extended and loaded into @code{r0}. + +@item axchg [rd + offset16], rs +@itemx rs = xchg_64 (rd + offset16, rs) +Atomic exchange. Atomically exchanges the value in @code{rs} with +the value addressed by @code{rd + offset16}. +@end table + +@noindent +The following instructions provide atomic arithmetic operations. @table @code @item aadd [rd + offset16], rs @@ -798,8 +816,26 @@ Alias to @code{aadd}. @subsection 32-bit atomic instructions -Atomic exchange-and-add instructions are provided in two flavors: one -for swapping 32-bit quantities and another for 32-bit quantities. +32-bit atomic exchange instructions are provided in two flavors: one +for compare-and-swap, one for unconditional exchange. + +@table @code +@item acmp32 [rd + offset16], rs +@itemx w0 = cmpxchg32_32 (rd + offset16, w0, ws) +Atomic compare-and-swap. Compares value in @code{w0} to value +addressed by @code{rd + offset16}. On match, the value addressed by +@code{rd + offset16} is replaced with the value in @code{ws}. +Regardless, the value that was at @code{rd + offset16} is +zero-extended and loaded into @code{w0}. + +@item axchg [rd + offset16], rs +@itemx ws = xchg32_32 (rd + offset16, ws) +Atomic exchange. Atomically exchanges the value in @code{ws} with +the value addressed by @code{rd + offset16}. +@end table + +@noindent +The following instructions provide 32-bit atomic arithmetic operations. @table @code @item aadd32 [rd + offset16], rs |