qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: qemu-devel@nongnu.org
Cc: qemu-s390x@nongnu.org, Thomas Huth <thuth@redhat.com>,
	Cornelia Huck <cohuck@redhat.com>,
	Richard Henderson <rth@twiddle.net>,
	David Hildenbrand <david@redhat.com>
Subject: [Qemu-devel] [PATCH v1 03/33] s390x: Add one temporary vector register in CPU state for TCG
Date: Tue, 26 Feb 2019 12:38:45 +0100	[thread overview]
Message-ID: <20190226113915.20150-4-david@redhat.com> (raw)
In-Reply-To: <20190226113915.20150-1-david@redhat.com>

We sometimes want to work on a temporary vector register instead of the
actual destination, because source and destination might overlap. An
alternative would be loading the vector into two i64 variables, but than
separate handling for accessing the vector elements would be needed.
This is easier. Add one for now as that seems to be enough.

Signed-off-by: David Hildenbrand <david@redhat.com>
---
 target/s390x/cpu.h       | 11 +++++++++++
 target/s390x/translate.c |  3 +++
 2 files changed, 14 insertions(+)

diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h
index cb6d77053a..a8dc0b2b83 100644
--- a/target/s390x/cpu.h
+++ b/target/s390x/cpu.h
@@ -67,6 +67,17 @@ struct CPUS390XState {
      * vregs[0][0] -> vregs[15][0] are 16 floating point registers
      */
     CPU_DoubleU vregs[32][2];  /* vector registers */
+#ifdef CONFIG_TCG
+#define TMP_VREG_0   33
+    /*
+     * Temporary vector registers used while processing vector instructions
+     * in TCG. This is helpful e.g. when source and destination registers
+     * overlap for certain instructions in translate functions. Content valid
+     * only within execution of one translated block, therefore no migration is
+     * needed. Resets don't mather, but has to be properly aligned.
+     */
+    CPU_DoubleU tmp_vregs[1][2];
+#endif
     uint32_t aregs[16];    /* access registers */
     uint8_t riccb[64];     /* runtime instrumentation control */
     uint64_t gscb[4];      /* guarded storage control */
diff --git a/target/s390x/translate.c b/target/s390x/translate.c
index d52c02c572..8733d19182 100644
--- a/target/s390x/translate.c
+++ b/target/s390x/translate.c
@@ -147,6 +147,9 @@ void s390x_translate_init(void)
 
 static inline int vec_full_reg_offset(uint8_t reg)
 {
+    if (reg == TMP_VREG_0) {
+        return offsetof(CPUS390XState, tmp_vregs[0][0].d);
+    }
     g_assert(reg < 32);
     return offsetof(CPUS390XState, vregs[reg][0].d);
 }
-- 
2.17.2

  parent reply	other threads:[~2019-02-26 11:39 UTC|newest]

Thread overview: 94+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-26 11:38 [Qemu-devel] [PATCH v1 00/33] s390x/tcg: Vector Instruction Support Part 1 David Hildenbrand
2019-02-26 11:38 ` [Qemu-devel] [PATCH v1 01/33] s390x/tcg: Define vector instruction formats David Hildenbrand
2019-02-26 18:24   ` Richard Henderson
2019-02-26 11:38 ` [Qemu-devel] [PATCH v1 02/33] s390x/tcg: Check vector register instructions at central point David Hildenbrand
2019-02-26 18:26   ` Richard Henderson
2019-02-26 11:38 ` David Hildenbrand [this message]
2019-02-26 18:36   ` [Qemu-devel] [PATCH v1 03/33] s390x: Add one temporary vector register in CPU state for TCG Richard Henderson
2019-02-26 18:45     ` David Hildenbrand
2019-02-26 11:38 ` [Qemu-devel] [PATCH v1 04/33] s390x/tcg: Utilities for vector instruction helpers David Hildenbrand
2019-02-26 11:38 ` [Qemu-devel] [PATCH v1 05/33] s390x/tcg: Implement VECTOR GATHER ELEMENT David Hildenbrand
2019-02-26 18:44   ` Richard Henderson
2019-02-26 11:38 ` [Qemu-devel] [PATCH v1 06/33] s390x/tcg: Implement VECTOR GENERATE BYTE MASK David Hildenbrand
2019-02-26 19:12   ` Richard Henderson
2019-02-26 19:23     ` David Hildenbrand
2019-02-26 21:23       ` David Hildenbrand
2019-02-26 11:38 ` [Qemu-devel] [PATCH v1 07/33] s390x/tcg: Implement VECTOR GENERATE MASK David Hildenbrand
2019-02-26 21:16   ` David Hildenbrand
2019-02-27 15:29     ` Richard Henderson
2019-02-26 11:38 ` [Qemu-devel] [PATCH v1 08/33] s390x/tcg: Implement VECTOR LOAD David Hildenbrand
2019-02-27 15:39   ` Richard Henderson
2019-02-28  7:48     ` David Hildenbrand
2019-02-28 16:34       ` Richard Henderson
2019-02-28 16:40         ` David Hildenbrand
2019-02-26 11:38 ` [Qemu-devel] [PATCH v1 09/33] s390x/tcg: Implement VECTOR LOAD AND REPLICATE David Hildenbrand
2019-02-27 15:40   ` Richard Henderson
2019-02-26 11:38 ` [Qemu-devel] [PATCH v1 10/33] s390x/tcg: Implement VECTOR LOAD ELEMENT David Hildenbrand
2019-02-27 15:42   ` Richard Henderson
2019-02-26 11:38 ` [Qemu-devel] [PATCH v1 11/33] s390x/tcg: Implement VECTOR LOAD ELEMENT IMMEDIATE David Hildenbrand
2019-02-27 15:44   ` Richard Henderson
2019-02-26 11:38 ` [Qemu-devel] [PATCH v1 12/33] s390x/tcg: Implement VECTOR LOAD GR FROM VR ELEMENT David Hildenbrand
2019-02-27 15:53   ` Richard Henderson
2019-02-28  8:27     ` David Hildenbrand
2019-02-28 17:10       ` Richard Henderson
2019-02-26 11:38 ` [Qemu-devel] [PATCH v1 13/33] s390x/tcg: Implement VECTOR LOAD LOGICAL ELEMENT AND ZERO David Hildenbrand
2019-02-27 15:56   ` Richard Henderson
2019-02-28  8:30     ` David Hildenbrand
2019-02-26 11:38 ` [Qemu-devel] [PATCH v1 14/33] s390x/tcg: Implement VECTOR LOAD MULTIPLE David Hildenbrand
2019-02-27 16:02   ` Richard Henderson
2019-02-28  8:36     ` David Hildenbrand
2019-02-28 17:15       ` Richard Henderson
2019-02-28 19:05         ` David Hildenbrand
2019-03-01  6:34           ` Richard Henderson
2019-02-26 11:38 ` [Qemu-devel] [PATCH v1 15/33] s390x/tcg: Implement VECTOR LOAD TO BLOCK BOUNDARY David Hildenbrand
2019-02-27 16:08   ` Richard Henderson
2019-02-28  8:40     ` David Hildenbrand
2019-02-26 11:38 ` [Qemu-devel] [PATCH v1 16/33] s390x/tcg: Implement VECTOR LOAD VR ELEMENT FROM GR David Hildenbrand
2019-02-27 16:08   ` Richard Henderson
2019-02-26 11:38 ` [Qemu-devel] [PATCH v1 17/33] s390x/tcg: Implement VECTOR LOAD VR FROM GRS DISJOINT David Hildenbrand
2019-02-27 16:10   ` Richard Henderson
2019-02-26 11:39 ` [Qemu-devel] [PATCH v1 18/33] s390x/tcg: Implement VECTOR LOAD WITH LENGTH David Hildenbrand
2019-02-27 16:12   ` Richard Henderson
2019-02-26 11:39 ` [Qemu-devel] [PATCH v1 19/33] s390x/tcg: Implement VECTOR MERGE (HIGH|LOW) David Hildenbrand
2019-02-27 16:14   ` Richard Henderson
2019-02-27 16:20   ` Richard Henderson
2019-02-28  8:54     ` David Hildenbrand
2019-02-26 11:39 ` [Qemu-devel] [PATCH v1 20/33] s390x/tcg: Implement VECTOR PACK David Hildenbrand
2019-02-27 23:11   ` Richard Henderson
2019-02-26 11:39 ` [Qemu-devel] [PATCH v1 21/33] s390x/tcg: Implement VECTOR PACK (LOGICAL) SATURATE David Hildenbrand
2019-02-27 23:18   ` Richard Henderson
2019-02-27 23:24   ` Richard Henderson
2019-02-26 11:39 ` [Qemu-devel] [PATCH v1 22/33] s390x/tcg: Implement VECTOR PERMUTE David Hildenbrand
2019-02-27 23:21   ` Richard Henderson
2019-02-26 11:39 ` [Qemu-devel] [PATCH v1 23/33] s390x/tcg: Implement VECTOR PERMUTE DOUBLEWORD IMMEDIATE David Hildenbrand
2019-02-27 23:26   ` Richard Henderson
2019-02-26 11:39 ` [Qemu-devel] [PATCH v1 24/33] s390x/tcg: Implement VECTOR REPLICATE David Hildenbrand
2019-02-27 23:29   ` Richard Henderson
2019-02-27 23:31   ` Richard Henderson
2019-02-26 11:39 ` [Qemu-devel] [PATCH v1 25/33] s390x/tcg: Implement VECTOR REPLICATE IMMEDIATE David Hildenbrand
2019-02-27 23:39   ` Richard Henderson
2019-02-28  9:07     ` David Hildenbrand
2019-02-26 11:39 ` [Qemu-devel] [PATCH v1 26/33] s390x/tcg: Implement VECTOR SCATTER ELEMENT David Hildenbrand
2019-02-27 23:40   ` Richard Henderson
2019-02-26 11:39 ` [Qemu-devel] [PATCH v1 27/33] s390x/tcg: Implement VECTOR SELECT David Hildenbrand
2019-02-27 23:42   ` Richard Henderson
2019-02-28  9:09     ` David Hildenbrand
2019-02-26 11:39 ` [Qemu-devel] [PATCH v1 28/33] s390x/tcg: Implement VECTOR SIGN EXTEND TO DOUBLEWORD David Hildenbrand
2019-02-27 23:43   ` Richard Henderson
2019-02-26 11:39 ` [Qemu-devel] [PATCH v1 29/33] s390x/tcg: Implement VECTOR STORE David Hildenbrand
2019-02-27 23:46   ` Richard Henderson
2019-02-28  9:11     ` David Hildenbrand
2019-02-26 11:39 ` [Qemu-devel] [PATCH v1 30/33] s390x/tcg: Implement VECTOR STORE ELEMENT David Hildenbrand
2019-02-27 23:47   ` Richard Henderson
2019-02-26 11:39 ` [Qemu-devel] [PATCH v1 31/33] s390x/tcg: Implement VECTOR STORE MULTIPLE David Hildenbrand
2019-02-27 23:48   ` Richard Henderson
2019-02-26 11:39 ` [Qemu-devel] [PATCH v1 32/33] s390x/tcg: Implement VECTOR STORE WITH LENGTH David Hildenbrand
2019-02-27 23:49   ` Richard Henderson
2019-02-28  9:13     ` David Hildenbrand
2019-02-26 11:39 ` [Qemu-devel] [PATCH v1 33/33] s390x/tcg: Implement VECTOR UNPACK * David Hildenbrand
2019-02-28  0:03   ` Richard Henderson
2019-02-28  9:28     ` David Hildenbrand
2019-02-28 10:54       ` David Hildenbrand
2019-02-28 18:22         ` Richard Henderson
2019-02-28 19:45           ` David Hildenbrand
2019-02-28  7:24 ` [Qemu-devel] [PATCH v1 00/33] s390x/tcg: Vector Instruction Support Part 1 David Hildenbrand

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=20190226113915.20150-4-david@redhat.com \
    --to=david@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=thuth@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 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).