qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: matheus.ferst@eldorado.org.br
To: qemu-devel@nongnu.org
Cc: Matheus Ferst <matheus.ferst@eldorado.org.br>,
	gustavo.romero@protonmail.com, f4bug@amsat.org,
	qemu-ppc@nongnu.org, bruno.larsen@eldorado.org.br,
	alex.bennee@linaro.org, david@gibson.dropbear.id.au
Subject: [PATCH 2/2] tests/tcg/ppc64le: tests for brh/brw/brd
Date: Mon, 19 Apr 2021 22:33:08 -0300	[thread overview]
Message-ID: <20210420013308.813323-3-matheus.ferst@eldorado.org.br> (raw)
In-Reply-To: <20210420013308.813323-1-matheus.ferst@eldorado.org.br>

From: Matheus Ferst <matheus.ferst@eldorado.org.br>

Tests for Byte-Reverse Halfword, Word and Doubleword

Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br>
---
 tests/tcg/ppc64/Makefile.target   |  7 +++++++
 tests/tcg/ppc64le/Makefile.target |  7 +++++++
 tests/tcg/ppc64le/byte_reverse.c  | 22 ++++++++++++++++++++++
 3 files changed, 36 insertions(+)
 create mode 100644 tests/tcg/ppc64le/byte_reverse.c

diff --git a/tests/tcg/ppc64/Makefile.target b/tests/tcg/ppc64/Makefile.target
index 0c6a4585fc..55c690c8ad 100644
--- a/tests/tcg/ppc64/Makefile.target
+++ b/tests/tcg/ppc64/Makefile.target
@@ -10,4 +10,11 @@ PPC64_TESTS=bcdsub
 endif
 bcdsub: CFLAGS += -mpower8-vector
 
+ifneq ($(DOCKER_IMAGE)$(CROSS_CC_HAS_POWER10),)
+POWER10_TESTS=byte_reverse
+RUN_POWER10_TESTS=$(patsubst %, run-%, $(POWER10_TESTS))
+$(RUN_POWER10_TESTS): QEMU_OPTS+=-cpu POWER10
+PPC64_TESTS += $(POWER10_TESTS)
+endif
+
 TESTS += $(PPC64_TESTS)
diff --git a/tests/tcg/ppc64le/Makefile.target b/tests/tcg/ppc64le/Makefile.target
index 1acfcff94a..517d290b1a 100644
--- a/tests/tcg/ppc64le/Makefile.target
+++ b/tests/tcg/ppc64le/Makefile.target
@@ -9,4 +9,11 @@ PPC64LE_TESTS=bcdsub
 endif
 bcdsub: CFLAGS += -mpower8-vector
 
+ifneq ($(DOCKER_IMAGE)$(CROSS_CC_HAS_POWER10),)
+POWER10_TESTS=byte_reverse
+RUN_POWER10_TESTS=$(patsubst %, run-%, $(POWER10_TESTS))
+$(RUN_POWER10_TESTS): QEMU_OPTS+=-cpu POWER10
+PPC64LE_TESTS += $(POWER10_TESTS)
+endif
+
 TESTS += $(PPC64LE_TESTS)
diff --git a/tests/tcg/ppc64le/byte_reverse.c b/tests/tcg/ppc64le/byte_reverse.c
new file mode 100644
index 0000000000..553b9870ae
--- /dev/null
+++ b/tests/tcg/ppc64le/byte_reverse.c
@@ -0,0 +1,22 @@
+#include <stdio.h>
+#include <assert.h>
+
+int main(void)
+{
+    unsigned long var;
+
+    var = 0xFEDCBA9876543210;
+    asm("brh %0, %0" : "=r"(var));
+    assert(var == 0xDCFE98BA54761032);
+
+    var = 0xFEDCBA9876543210;
+    asm("brw %0, %0" : "=r"(var));
+    assert(var == 0x98BADCFE10325476);
+
+    var = 0xFEDCBA9876543210;
+    asm("brd %0, %0" : "=r"(var));
+    assert(var == 0x1032547698BADCFE);
+
+    return 0;
+}
+
-- 
2.25.1



  parent reply	other threads:[~2021-04-20  1:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-20  1:33 [PATCH 0/2] tests/docker: tests/tcg/ppc64le: Newer toolchain to build tests for PowerISA v3.1 instructions matheus.ferst
2021-04-20  1:33 ` [PATCH 1/2] tests/docker: gcc-10 based images for ppc64{,le} tests matheus.ferst
2021-04-20  3:59   ` David Gibson
2021-04-20 12:20     ` [PATCH 1/2] tests/docker: gcc-10 based images for ppc64{, le} tests Alex Bennée
2021-04-20 12:35       ` Philippe Mathieu-Daudé
2021-04-20 15:06         ` Matheus K. Ferst
2021-04-20 14:31       ` [PATCH 1/2] tests/docker: gcc-10 based images for ppc64{,le} tests Matheus K. Ferst
2021-04-20 16:53         ` [PATCH 1/2] tests/docker: gcc-10 based images for ppc64{, le} tests Alex Bennée
2021-04-20  1:33 ` matheus.ferst [this message]
2021-04-20 14:58   ` [PATCH 2/2] tests/tcg/ppc64le: tests for brh/brw/brd Richard Henderson
2021-04-20 15:12     ` Matheus K. Ferst
2021-04-20 14:58   ` Richard Henderson
2021-04-20 15:12     ` Matheus K. Ferst

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=20210420013308.813323-3-matheus.ferst@eldorado.org.br \
    --to=matheus.ferst@eldorado.org.br \
    --cc=alex.bennee@linaro.org \
    --cc=bruno.larsen@eldorado.org.br \
    --cc=david@gibson.dropbear.id.au \
    --cc=f4bug@amsat.org \
    --cc=gustavo.romero@protonmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.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 NNTP newsgroup(s).