All of lore.kernel.org
 help / color / mirror / Atom feed
From: matheus.ferst@eldorado.org.br
To: qemu-devel@nongnu.org
Cc: thuth@redhat.com, Matheus Ferst <matheus.ferst@eldorado.org.br>,
	gustavo.romero@protonmail.com, f4bug@amsat.org,
	wainersm@redhat.com, luis.pires@eldorado.org.br,
	qemu-ppc@nongnu.org, alex.bennee@linaro.org,
	david@gibson.dropbear.id.au
Subject: [RFC PATCH 3/3] tests/tcg/ppc64le: R=1 test for paddi
Date: Thu, 15 Apr 2021 18:41:38 -0300	[thread overview]
Message-ID: <20210415214138.563795-4-matheus.ferst@eldorado.org.br> (raw)
In-Reply-To: <20210415214138.563795-1-matheus.ferst@eldorado.org.br>

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

This test exercise the R=1 path of paddi implementation using the
extended mnemonic "pla".

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

diff --git a/tests/tcg/ppc64/Makefile.target b/tests/tcg/ppc64/Makefile.target
index 6eccd2c06f..a6cd7a21b2 100644
--- a/tests/tcg/ppc64/Makefile.target
+++ b/tests/tcg/ppc64/Makefile.target
@@ -11,8 +11,9 @@ endif
 bcdsub: CFLAGS += -mpower8-vector
 
 ifneq ($(DOCKER_IMAGE)$(CROSS_CC_HAS_POWER10),)
-PPC64LE_TESTS += pli_33bits
+PPC64LE_TESTS += pli_33bits pla
 endif
 pli_33bits: CFLAGS += -mpower10
+pla: CFLAGS += -mpower10
 
 TESTS += $(PPC64_TESTS)
diff --git a/tests/tcg/ppc64le/Makefile.target b/tests/tcg/ppc64le/Makefile.target
index 2003eab2df..db92b2ec99 100644
--- a/tests/tcg/ppc64le/Makefile.target
+++ b/tests/tcg/ppc64le/Makefile.target
@@ -10,8 +10,9 @@ endif
 bcdsub: CFLAGS += -mpower8-vector
 
 ifneq ($(DOCKER_IMAGE)$(CROSS_CC_HAS_POWER10),)
-PPC64LE_TESTS += pli_33bits
+PPC64LE_TESTS += pli_33bits pla
 endif
 pli_33bits: CFLAGS += -mpower10
+pla: CFLAGS += -mpower10
 
 TESTS += $(PPC64LE_TESTS)
diff --git a/tests/tcg/ppc64le/pla.c b/tests/tcg/ppc64le/pla.c
new file mode 100644
index 0000000000..4826579216
--- /dev/null
+++ b/tests/tcg/ppc64le/pla.c
@@ -0,0 +1,26 @@
+#include <assert.h>
+#include <unistd.h>
+#include <signal.h>
+
+int main(void)
+{
+    long unsigned int label, addr;
+    struct sigaction action;
+
+    action.sa_handler = _exit;
+    sigaction(SIGABRT, &action, NULL);
+
+    asm("insn:\n"
+        " lis    %0, insn@highest\n"
+        " addi   %0, %0, insn@higher\n"
+        " rldicr %0, %0, 32, 31\n"
+        " oris   %0, %0, insn@h\n"
+        " ori    %0, %0, insn@l\n"
+        " pla    %1, %2\n"
+        : "=r" (label), "=r" (addr)
+        : "i" (-5 * 4)); /* number of instruction between label and pla */
+    assert(addr == label);
+
+    return 0;
+}
+
-- 
2.25.1



  parent reply	other threads:[~2021-04-15 22:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-15 21:41 [RFC PATCH 0/3] tests/tcg/ppc64le: paddi tests matheus.ferst
2021-04-15 21:41 ` [RFC PATCH 1/3] tests/docker: gcc-10 based images for ppc64{, le} tests matheus.ferst
2021-04-16  3:58   ` David Gibson
2021-04-16 14:07     ` [RFC PATCH 1/3] tests/docker: gcc-10 based images for ppc64{,le} tests Alex Bennée
2021-04-15 21:41 ` [RFC PATCH 2/3] tests/tcg/ppc64le: load 33-bits constant with paddi matheus.ferst
2021-04-15 21:41 ` matheus.ferst [this message]
2021-04-16  3:52 ` [RFC PATCH 0/3] tests/tcg/ppc64le: paddi tests David Gibson
2021-04-16 14:13   ` Matheus K. Ferst
2021-04-19  1:14     ` David Gibson

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=20210415214138.563795-4-matheus.ferst@eldorado.org.br \
    --to=matheus.ferst@eldorado.org.br \
    --cc=alex.bennee@linaro.org \
    --cc=david@gibson.dropbear.id.au \
    --cc=f4bug@amsat.org \
    --cc=gustavo.romero@protonmail.com \
    --cc=luis.pires@eldorado.org.br \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=thuth@redhat.com \
    --cc=wainersm@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.