diff options
author | David Faust <david.faust@oracle.com> | 2023-07-24 09:45:17 -0700 |
---|---|---|
committer | David Faust <david.faust@oracle.com> | 2023-07-26 09:29:33 -0700 |
commit | db189d02ef150517e955d0d7a913168dd48f21cd (patch) | |
tree | 0faed333285ee20c457d7aeffd79b17036370178 /gcc/function-abi.cc | |
parent | 7931a1de9ec87b996d51d3d60786f5c81f63919f (diff) | |
download | gcc-db189d02ef150517e955d0d7a913168dd48f21cd.zip gcc-db189d02ef150517e955d0d7a913168dd48f21cd.tar.gz gcc-db189d02ef150517e955d0d7a913168dd48f21cd.tar.bz2 |
bpf: add v3 atomic instructions
This patch adds support for the general atomic operations introduced in
eBPF v3. In addition to the existing atomic add instruction, this adds:
- Atomic and, or, xor
- Fetching versions of these operations (including add)
- Atomic exchange
- Atomic compare-and-exchange
To control emission of these instructions, a new target option
-m[no-]v3-atomics is added. This option is enabled by -mcpu=v3
and above.
Support for these instructions was recently added in binutils.
gcc/
* config/bpf/bpf.opt (mv3-atomics): New option.
* config/bpf/bpf.cc (bpf_option_override): Handle it here.
* config/bpf/bpf.h (enum_reg_class): Add R0 class.
(REG_CLASS_NAMES): Likewise.
(REG_CLASS_CONTENTS): Likewise.
(REGNO_REG_CLASS): Handle R0.
* config/bpf/bpf.md (UNSPEC_XADD): Rename to UNSPEC_AADD.
(UNSPEC_AAND): New unspec.
(UNSPEC_AOR): Likewise.
(UNSPEC_AXOR): Likewise.
(UNSPEC_AFADD): Likewise.
(UNSPEC_AFAND): Likewise.
(UNSPEC_AFOR): Likewise.
(UNSPEC_AFXOR): Likewise.
(UNSPEC_AXCHG): Likewise.
(UNSPEC_ACMPX): Likewise.
(atomic_add<mode>): Use UNSPEC_AADD and atomic type attribute.
Move to...
* config/bpf/atomic.md: ...Here. New file.
* config/bpf/constraints.md (t): New constraint for R0.
* doc/invoke.texi (eBPF Options): Document -mv3-atomics.
gcc/testsuite/
* gcc.target/bpf/atomic-cmpxchg-1.c: New test.
* gcc.target/bpf/atomic-cmpxchg-2.c: New test.
* gcc.target/bpf/atomic-fetch-op-1.c: New test.
* gcc.target/bpf/atomic-fetch-op-2.c: New test.
* gcc.target/bpf/atomic-fetch-op-3.c: New test.
* gcc.target/bpf/atomic-op-1.c: New test.
* gcc.target/bpf/atomic-op-2.c: New test.
* gcc.target/bpf/atomic-op-3.c: New test.
* gcc.target/bpf/atomic-xchg-1.c: New test.
* gcc.target/bpf/atomic-xchg-2.c: New test.
Diffstat (limited to 'gcc/function-abi.cc')
0 files changed, 0 insertions, 0 deletions