bpf: use xBPF signed div, mod insns when available
authorDavid Faust <david.faust@oracle.com>
Tue, 22 Sep 2020 18:31:35 +0000 (20:31 +0200)
committerJose E. Marchesi <jose.marchesi@oracle.com>
Tue, 22 Sep 2020 18:31:35 +0000 (20:31 +0200)
commit7c8ba5da80d5d95a8521010d6731d0d83036145d
tree2e140dde7f05e626f15a17684ee603936270c145
parent30bf947649e7381402637d1434d6b1ef22d031f1
bpf: use xBPF signed div, mod insns when available

The 'mod' and 'div' operators in eBPF are unsigned, with no signed
counterpart. xBPF adds two new ALU operations, sdiv and smod, for
signed division and modulus, respectively. Update bpf.md with
'define_insn' blocks for signed div and mod to use them when targetting
xBPF, and add new tests to ensure they are used appropriately.

2020-09-17  David Faust  <david.faust@oracle.com>

gcc/
* config/bpf/bpf.md: Add defines for signed div and mod operators.

gcc/testsuite/
* gcc.target/bpf/diag-sdiv.c: New test.
* gcc.target/bpf/diag-smod.c: New test.
* gcc.target/bpf/xbpf-sdiv-1.c: New test.
* gcc.target/bpf/xbpf-smod-1.c: New test.
gcc/config/bpf/bpf.md
gcc/testsuite/gcc.target/bpf/diag-sdiv.c [new file with mode: 0644]
gcc/testsuite/gcc.target/bpf/diag-smod.c [new file with mode: 0644]
gcc/testsuite/gcc.target/bpf/xbpf-sdiv-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/bpf/xbpf-smod-1.c [new file with mode: 0644]