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 2/3] tests/tcg/ppc64le: load 33-bits constant with paddi
Date: Thu, 15 Apr 2021 18:41:37 -0300	[thread overview]
Message-ID: <20210415214138.563795-3-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 checks that we can correctly load a 33-bit constant and its
two's complement. At least until version 1.1-0, POWER10 Functional
Simulation fails this test, processing the immediate as if it were
32-bits instead of 34, so it's probably something to keep an eye on.

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

diff --git a/tests/tcg/ppc64/Makefile.target b/tests/tcg/ppc64/Makefile.target
index 0c6a4585fc..6eccd2c06f 100644
--- a/tests/tcg/ppc64/Makefile.target
+++ b/tests/tcg/ppc64/Makefile.target
@@ -10,4 +10,9 @@ PPC64_TESTS=bcdsub
 endif
 bcdsub: CFLAGS += -mpower8-vector
 
+ifneq ($(DOCKER_IMAGE)$(CROSS_CC_HAS_POWER10),)
+PPC64LE_TESTS += pli_33bits
+endif
+pli_33bits: CFLAGS += -mpower10
+
 TESTS += $(PPC64_TESTS)
diff --git a/tests/tcg/ppc64le/Makefile.target b/tests/tcg/ppc64le/Makefile.target
index 1acfcff94a..2003eab2df 100644
--- a/tests/tcg/ppc64le/Makefile.target
+++ b/tests/tcg/ppc64le/Makefile.target
@@ -9,4 +9,9 @@ PPC64LE_TESTS=bcdsub
 endif
 bcdsub: CFLAGS += -mpower8-vector
 
+ifneq ($(DOCKER_IMAGE)$(CROSS_CC_HAS_POWER10),)
+PPC64LE_TESTS += pli_33bits
+endif
+pli_33bits: CFLAGS += -mpower10
+
 TESTS += $(PPC64LE_TESTS)
diff --git a/tests/tcg/ppc64le/pli_33bits.c b/tests/tcg/ppc64le/pli_33bits.c
new file mode 100644
index 0000000000..848cbce165
--- /dev/null
+++ b/tests/tcg/ppc64le/pli_33bits.c
@@ -0,0 +1,22 @@
+#include <assert.h>
+#include <unistd.h>
+#include <signal.h>
+
+int main(void)
+{
+    long int var;
+    struct sigaction action;
+
+    action.sa_handler = _exit;
+    sigaction(SIGABRT, &action, NULL);
+
+    asm(" pli %0,0x1FFFFFFFF\n"
+        : "=r"(var));
+    assert(var == 0x1FFFFFFFF);
+
+    asm(" pli %0,-0x1FFFFFFFF\n"
+       : "=r"(var));
+    assert(var == -0x1FFFFFFFF);
+
+    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 ` matheus.ferst [this message]
2021-04-15 21:41 ` [RFC PATCH 3/3] tests/tcg/ppc64le: R=1 test for paddi matheus.ferst
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-3-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.