diff options
author | Jose E. Marchesi <jose.marchesi@oracle.com> | 2023-07-24 10:56:27 +0200 |
---|---|---|
committer | Jose E. Marchesi <jose.marchesi@oracle.com> | 2023-07-24 11:01:35 +0200 |
commit | f1e34551e4d6e259ab3bd0c9aba4fa1f0c448214 (patch) | |
tree | f2e5953e8ea087dc908bf5d45f0b7b72f8acebd2 /gcc/doc | |
parent | 8390a2af1397ba86ea2cf80d58007b8b69a9a6eb (diff) | |
download | gcc-f1e34551e4d6e259ab3bd0c9aba4fa1f0c448214.zip gcc-f1e34551e4d6e259ab3bd0c9aba4fa1f0c448214.tar.gz gcc-f1e34551e4d6e259ab3bd0c9aba4fa1f0c448214.tar.bz2 |
bpf: make use of the bswap{16,32,64} V4 BPF instruction
This patch makes the BPF backend to use the new V4 bswap{16,32,64}
instructions in order to implement the __builtin_bswap{16,32,64}
built-ins. It also adds support for -mcpu=v4 and -m[no]bswap
command-line options. Tests and doc updates are includes.
Tested in bpf-unknown-none.
gcc/ChangeLog
PR target/110786
* config/bpf/bpf.opt (mcpu): Add ISA_V4 and make it the default.
(mbswap): New option.
* config/bpf/bpf-opts.h (enum bpf_isa_version): New value ISA_V4.
* config/bpf/bpf.cc (bpf_option_override): Set bpf_has_bswap.
* config/bpf/bpf.md: Use bswap instructions if available for
bswap* insn, and fix constraint.
* doc/invoke.texi (eBPF Options): Document -mcpu=v4 and -mbswap.
gcc/testsuite/ChangeLog
PR target/110786
* gcc.target/bpf/bswap-1.c: Pass -mcpu=v3 to build test.
* gcc.target/bpf/bswap-2.c: New test.
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/invoke.texi | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index efd356e..a977a34 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -24707,10 +24707,14 @@ Enable 32-bit jump instructions. Enabled for CPU v3 and above. @item -malu32 Enable 32-bit ALU instructions. Enabled for CPU v3 and above. +@opindex mbswap +@item -mbswap +Enable byte swap instructions. Enabled for CPU v4 and above. + @opindex mcpu @item -mcpu=@var{version} This specifies which version of the eBPF ISA to target. Newer versions -may not be supported by all kernels. The default is @samp{v3}. +may not be supported by all kernels. The default is @samp{v4}. Supported values for @var{version} are: @@ -24728,6 +24732,11 @@ All features of v2, plus: @item 32-bit ALU operations, as in @option{-malu32} @end itemize +@item v4 +All features of v3, plus: +@itemize @minus +@item Byte swap instructions, as in @option{-mbswap} +@end itemize @end table @opindex mco-re |