From 1f8350173667b9037d440be3b755f4999a845f85 Mon Sep 17 00:00:00 2001 From: "Jose E. Marchesi" Date: Wed, 10 May 2023 18:41:14 +0200 Subject: gas: add tests for BPF V3 atomic instructions 2023-05-10 Jose E. Marchesi * testsuite/gas/bpf/atomic-v3.s: New file. * testsuite/gas/bpf/atomic-v3.d: Likewise. * testsuite/gas/bpf/atomic-v3-be.d: Likewise. * testsuite/gas/bpf/bpf.exp: Run atomic-v3 and atomic-v3-be. --- gas/ChangeLog | 9 ++++++++- gas/testsuite/gas/bpf/atomic-v3-be.d | 30 ++++++++++++++++++++++++++++++ gas/testsuite/gas/bpf/atomic-v3.d | 30 ++++++++++++++++++++++++++++++ gas/testsuite/gas/bpf/atomic-v3.s | 22 ++++++++++++++++++++++ gas/testsuite/gas/bpf/bpf.exp | 2 ++ 5 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 gas/testsuite/gas/bpf/atomic-v3-be.d create mode 100644 gas/testsuite/gas/bpf/atomic-v3.d create mode 100644 gas/testsuite/gas/bpf/atomic-v3.s diff --git a/gas/ChangeLog b/gas/ChangeLog index 966f1c5..a16647b 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,8 +1,15 @@ +2023-05-10 Jose E. Marchesi + + * testsuite/gas/bpf/atomic-v3.s: New file. + * testsuite/gas/bpf/atomic-v3.d: Likewise. + * testsuite/gas/bpf/atomic-v3-be.d: Likewise. + * testsuite/gas/bpf/bpf.exp: Run atomic-v3 and atomic-v3-be. + 2023-04-27 Jose E. Marchesi * testsuite/gas/bpf/mem.dump: New file. * testsuite/gas/bpf/mem-pseudoc.d: Likewise. - * testsuite/gas/bpf/mem.d: #dump mem.dump. + * testsuite/gas/bpf/mem.d: #dump mem.dump. * testsuite/gas/bpf/lddw.dump: New file. * testsuite/gas/bpf/lddw-pseudoc.d: Likewise. * testsuite/gas/bpf/lddw.d: #dump lddw.dump. diff --git a/gas/testsuite/gas/bpf/atomic-v3-be.d b/gas/testsuite/gas/bpf/atomic-v3-be.d new file mode 100644 index 0000000..6648bc6 --- /dev/null +++ b/gas/testsuite/gas/bpf/atomic-v3-be.d @@ -0,0 +1,30 @@ +#as: --EB +#objdump: -dr +#source: atomic-v3.s +#name: eBPF V3 atomic instructions, big-endian, normal syntax + +.*: +file format .*bpf.* + +Disassembly of section .text: + +0+ <.text>: + 0: db 12 1e ef 00 00 00 00 xadddw \[%r1\+0x1eef\],%r2 + 8: c3 12 1e ef 00 00 00 00 xaddw \[%r1\+0x1eef\],%r2 + 10: db 12 1e ef 00 00 00 40 xordw \[%r1\+0x1eef\],%r2 + 18: c3 12 1e ef 00 00 00 40 xorw \[%r1\+0x1eef\],%r2 + 20: db 12 1e ef 00 00 00 50 xanddw \[%r1\+0x1eef\],%r2 + 28: c3 12 1e ef 00 00 00 50 xandw \[%r1\+0x1eef\],%r2 + 30: db 12 1e ef 00 00 00 a0 xxordw \[%r1\+0x1eef\],%r2 + 38: c3 12 1e ef 00 00 00 a0 xxorw \[%r1\+0x1eef\],%r2 + 40: db 12 1e ef 00 00 00 01 xfadddw \[%r1\+0x1eef\],%r2 + 48: c3 12 1e ef 00 00 00 01 xfaddw \[%r1\+0x1eef\],%r2 + 50: db 12 1e ef 00 00 00 41 xfordw \[%r1\+0x1eef\],%r2 + 58: c3 12 1e ef 00 00 00 41 xforw \[%r1\+0x1eef\],%r2 + 60: db 12 1e ef 00 00 00 51 xfanddw \[%r1\+0x1eef\],%r2 + 68: c3 12 1e ef 00 00 00 51 xfandw \[%r1\+0x1eef\],%r2 + 70: db 12 1e ef 00 00 00 a1 xfxordw \[%r1\+0x1eef\],%r2 + 78: c3 12 1e ef 00 00 00 a1 xfxorw \[%r1\+0x1eef\],%r2 + 80: db 12 1e ef 00 00 00 e1 xchgdw \[%r1\+0x1eef\],%r2 + 88: c3 12 1e ef 00 00 00 e1 xchgw \[%r1\+0x1eef\],%r2 + 90: db 12 1e ef 00 00 00 f1 xcmpdw \[%r1\+0x1eef\],%r2 + 98: c3 12 1e ef 00 00 00 f1 xcmpw \[%r1\+0x1eef\],%r2 diff --git a/gas/testsuite/gas/bpf/atomic-v3.d b/gas/testsuite/gas/bpf/atomic-v3.d new file mode 100644 index 0000000..23649c7 --- /dev/null +++ b/gas/testsuite/gas/bpf/atomic-v3.d @@ -0,0 +1,30 @@ +#as: --EL +#objdump: -dr +#source: atomic-v3.s +#name: eBPF V3 atomic instructions, litle-endian, normal syntax + +.*: +file format .*bpf.* + +Disassembly of section .text: + +0+ <.text>: + 0: db 21 ef 1e 00 00 00 00 xadddw \[%r1\+0x1eef\],%r2 + 8: c3 21 ef 1e 00 00 00 00 xaddw \[%r1\+0x1eef\],%r2 + 10: db 21 ef 1e 40 00 00 00 xordw \[%r1\+0x1eef\],%r2 + 18: c3 21 ef 1e 40 00 00 00 xorw \[%r1\+0x1eef\],%r2 + 20: db 21 ef 1e 50 00 00 00 xanddw \[%r1\+0x1eef\],%r2 + 28: c3 21 ef 1e 50 00 00 00 xandw \[%r1\+0x1eef\],%r2 + 30: db 21 ef 1e a0 00 00 00 xxordw \[%r1\+0x1eef\],%r2 + 38: c3 21 ef 1e a0 00 00 00 xxorw \[%r1\+0x1eef\],%r2 + 40: db 21 ef 1e 01 00 00 00 xfadddw \[%r1\+0x1eef\],%r2 + 48: c3 21 ef 1e 01 00 00 00 xfaddw \[%r1\+0x1eef\],%r2 + 50: db 21 ef 1e 41 00 00 00 xfordw \[%r1\+0x1eef\],%r2 + 58: c3 21 ef 1e 41 00 00 00 xforw \[%r1\+0x1eef\],%r2 + 60: db 21 ef 1e 51 00 00 00 xfanddw \[%r1\+0x1eef\],%r2 + 68: c3 21 ef 1e 51 00 00 00 xfandw \[%r1\+0x1eef\],%r2 + 70: db 21 ef 1e a1 00 00 00 xfxordw \[%r1\+0x1eef\],%r2 + 78: c3 21 ef 1e a1 00 00 00 xfxorw \[%r1\+0x1eef\],%r2 + 80: db 21 ef 1e e1 00 00 00 xchgdw \[%r1\+0x1eef\],%r2 + 88: c3 21 ef 1e e1 00 00 00 xchgw \[%r1\+0x1eef\],%r2 + 90: db 21 ef 1e f1 00 00 00 xcmpdw \[%r1\+0x1eef\],%r2 + 98: c3 21 ef 1e f1 00 00 00 xcmpw \[%r1\+0x1eef\],%r2 diff --git a/gas/testsuite/gas/bpf/atomic-v3.s b/gas/testsuite/gas/bpf/atomic-v3.s new file mode 100644 index 0000000..a17e95b --- /dev/null +++ b/gas/testsuite/gas/bpf/atomic-v3.s @@ -0,0 +1,22 @@ + # eBPF v3 atomic instructions + .text + xadddw [%r1+0x1eef], %r2 + xaddw [%r1+0x1eef], %r2 + xordw [%r1+0x1eef], %r2 + xorw [%r1+0x1eef], %r2 + xanddw [%r1+0x1eef], %r2 + xandw [%r1+0x1eef], %r2 + xxordw [%r1+0x1eef], %r2 + xxorw [%r1+0x1eef], %r2 + xfadddw [%r1+0x1eef], %r2 + xfaddw [%r1+0x1eef], %r2 + xfordw [%r1+0x1eef], %r2 + xforw [%r1+0x1eef], %r2 + xfanddw [%r1+0x1eef], %r2 + xfandw [%r1+0x1eef], %r2 + xfxordw [%r1+0x1eef], %r2 + xfxorw [%r1+0x1eef], %r2 + xchgdw [%r1+0x1eef], %r2 + xchgw [%r1+0x1eef], %r2 + xcmpdw [%r1+0x1eef], %r2 + xcmpw [%r1+0x1eef], %r2 diff --git a/gas/testsuite/gas/bpf/bpf.exp b/gas/testsuite/gas/bpf/bpf.exp index 5d91805..041abdf 100644 --- a/gas/testsuite/gas/bpf/bpf.exp +++ b/gas/testsuite/gas/bpf/bpf.exp @@ -34,6 +34,7 @@ if {[istarget bpf*-*-*]} { run_dump_test exit run_dump_test atomic run_dump_test atomic-pseudoc + run_dump_test atomic-v3 run_dump_test data run_dump_test pseudoc-normal @@ -48,6 +49,7 @@ if {[istarget bpf*-*-*]} { run_dump_test call-be run_dump_test exit-be run_dump_test atomic-be + run_dump_test atomic-v3-be run_dump_test data-be run_dump_test pseudoc-normal-be -- cgit v1.1