]> git.ipfire.org Git - thirdparty/gcc.git/commit
bpf: sdiv/smod are now part of BPF V4
authorJose E. Marchesi <jose.marchesi@oracle.com>
Mon, 24 Jul 2023 13:57:05 +0000 (15:57 +0200)
committerJose E. Marchesi <jose.marchesi@oracle.com>
Mon, 24 Jul 2023 13:59:54 +0000 (15:59 +0200)
commit4be3919fb75e3d2a4d2bb80ba33c14e0973bc08f
tree24d17f547efbdba654785169c822fdda484793e0
parentaa1e2d543869a07580f9b2112f2d7367f83a6753
bpf: sdiv/smod are now part of BPF V4

We used to support signed division and signed modulus instructions in
the XBPF GCC-specific extensions to BPF.  However, BPF catched up by
adding these instructions in the V4 of the ISA.

This patch changes GCC in order to use sdiv/smod instructions when
-mcpu=v4 or higher.  The testsuite and the manual have been updated
accordingly.

Tested in bpf-unknown-none.

gcc/ChangeLog

PR target/110783
* config/bpf/bpf.opt: New command-line option -msdiv.
* config/bpf/bpf.md: Conditionalize sdiv/smod on bpf_has_sdiv.
* config/bpf/bpf.cc (bpf_option_override): Initialize
bpf_has_sdiv.
* doc/invoke.texi (eBPF Options): Document -msdiv.

gcc/testsuite/ChangeLog

PR target/110783
* gcc.target/bpf/xbpf-sdiv-1.c: Renamed to sdiv-1.c
* gcc.target/bpf/xbpf-smod-1.c: Renamed to smod-1.c
* gcc.target/bpf/sdiv-1.c: Renamed from xbpf-sdiv-1.c, use -mcpu=v4.
* gcc.target/bpf/smod-1.c: Renamed from xbpf-smod-1.c, use -mcpu=v4.
* gcc.target/bpf/diag-sdiv.c: Use -mcpu=v3.
* gcc.target/bpf/diag-smod.c: Likewise.
gcc/config/bpf/bpf.cc
gcc/config/bpf/bpf.md
gcc/config/bpf/bpf.opt
gcc/doc/invoke.texi
gcc/testsuite/gcc.target/bpf/diag-sdiv.c
gcc/testsuite/gcc.target/bpf/diag-smod.c
gcc/testsuite/gcc.target/bpf/sdiv-1.c [moved from gcc/testsuite/gcc.target/bpf/xbpf-sdiv-1.c with 86% similarity]
gcc/testsuite/gcc.target/bpf/smod-1.c [moved from gcc/testsuite/gcc.target/bpf/xbpf-smod-1.c with 86% similarity]