public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "Jose E. Marchesi" <jose.marchesi@oracle.com>
To: binutils@sourceware.org
Subject: [PATCH 3/4] gas: add tests for BPF V3 atomic instructions
Date: Thu, 11 May 2023 16:13:50 +0200	[thread overview]
Message-ID: <20230511141351.18886-4-jose.marchesi@oracle.com> (raw)
In-Reply-To: <20230511141351.18886-1-jose.marchesi@oracle.com>

2023-05-10  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* 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 966f1c5de83..a16647bb4a4 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,8 +1,15 @@
+2023-05-10  Jose E. Marchesi  <jose.marchesi@oracle.com>
+
+	* 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  <jose.marchesi@oracle.com>
 
 	* 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 00000000000..6648bc669b3
--- /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 00000000000..23649c7e801
--- /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 00000000000..a17e95b6793
--- /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 5d91805f478..041abdf7e35 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
 
-- 
2.30.2


  parent reply	other threads:[~2023-05-11 14:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-11 14:13 [PATCH 0/4] Add support for V3 BPF " Jose E. Marchesi
2023-05-11 14:13 ` [PATCH 1/4] opcodes: use CGEN_INSN_LGUINT for base instructions Jose E. Marchesi
2023-05-11 16:05   ` Jan Beulich
2023-05-17 13:03   ` Nick Clifton
2023-05-17 14:03     ` Jose E. Marchesi
2023-07-21 22:34       ` David Faust
2023-07-22  6:53         ` Jose E. Marchesi
2023-05-11 14:13 ` [PATCH 2/4] cpu: add V3 BPF atomic instructions Jose E. Marchesi
2023-05-11 14:13 ` Jose E. Marchesi [this message]
2023-05-11 14:13 ` [PATCH 4/4] gas: document V3 BPF atomic instructions in the GAS manual Jose E. Marchesi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230511141351.18886-4-jose.marchesi@oracle.com \
    --to=jose.marchesi@oracle.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).