qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Cornelia Huck <cohuck@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-s390x@nongnu.org, qemu-devel@nongnu.org,
	David Hildenbrand <david@redhat.com>,
	Cornelia Huck <cohuck@redhat.com>
Subject: [Qemu-devel] [PULL 32/33] s390x/tcg: Implement VECTOR STORE WITH LENGTH
Date: Mon, 11 Mar 2019 10:03:21 +0100	[thread overview]
Message-ID: <20190311090322.21603-33-cohuck@redhat.com> (raw)
In-Reply-To: <20190311090322.21603-1-cohuck@redhat.com>

From: David Hildenbrand <david@redhat.com>

Very similar to VECTOR LOAD WITH LENGTH, just the opposite direction.
Properly probe write access before modifying memory.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190307121539.12842-32-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
---
 target/s390x/helper.h           |  1 +
 target/s390x/insn-data.def      |  2 ++
 target/s390x/translate_vx.inc.c | 13 +++++++++++++
 target/s390x/vec_helper.c       | 24 ++++++++++++++++++++++++
 4 files changed, 40 insertions(+)

diff --git a/target/s390x/helper.h b/target/s390x/helper.h
index e2710f4fb33b..0b494a2fd2cc 100644
--- a/target/s390x/helper.h
+++ b/target/s390x/helper.h
@@ -143,6 +143,7 @@ DEF_HELPER_5(gvec_vpkls_cc16, void, ptr, cptr, cptr, env, i32)
 DEF_HELPER_5(gvec_vpkls_cc32, void, ptr, cptr, cptr, env, i32)
 DEF_HELPER_5(gvec_vpkls_cc64, void, ptr, cptr, cptr, env, i32)
 DEF_HELPER_FLAGS_5(gvec_vperm, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, cptr, i32)
+DEF_HELPER_FLAGS_4(vstl, TCG_CALL_NO_WG, void, env, cptr, i64, i64)
 
 #ifndef CONFIG_USER_ONLY
 DEF_HELPER_3(servc, i32, env, i64, i64)
diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def
index 17fd9a898b56..00ba9444a3b3 100644
--- a/target/s390x/insn-data.def
+++ b/target/s390x/insn-data.def
@@ -1043,6 +1043,8 @@
     E(0xe70a, VSTEG,   VRX,   V,   la2, 0, 0, 0, vste, 0, ES_64, IF_VEC)
 /* VECTOR STORE MULTIPLE */
     F(0xe73e, VSTM,    VRS_a, V,   la2, 0, 0, 0, vstm, 0, IF_VEC)
+/* VECTOR STORE WITH LENGTH */
+    F(0xe73f, VSTL,    VRS_b, V,   la2, r3_32u, 0, 0, vstl, 0, IF_VEC)
 
 #ifndef CONFIG_USER_ONLY
 /* COMPARE AND SWAP AND PURGE */
diff --git a/target/s390x/translate_vx.inc.c b/target/s390x/translate_vx.inc.c
index 0c75374203c2..fcdda0c59147 100644
--- a/target/s390x/translate_vx.inc.c
+++ b/target/s390x/translate_vx.inc.c
@@ -882,3 +882,16 @@ static DisasJumpType op_vstm(DisasContext *s, DisasOps *o)
     tcg_temp_free_i64(tmp);
     return DISAS_NEXT;
 }
+
+static DisasJumpType op_vstl(DisasContext *s, DisasOps *o)
+{
+    const int v1_offs = vec_full_reg_offset(get_field(s->fields, v1));
+    TCGv_ptr a0 = tcg_temp_new_ptr();
+
+    /* convert highest index into an actual length */
+    tcg_gen_addi_i64(o->in2, o->in2, 1);
+    tcg_gen_addi_ptr(a0, cpu_env, v1_offs);
+    gen_helper_vstl(cpu_env, a0, o->addr1, o->in2);
+    tcg_temp_free_ptr(a0);
+    return DISAS_NEXT;
+}
diff --git a/target/s390x/vec_helper.c b/target/s390x/vec_helper.c
index 021695b38c21..bb4c9304f09b 100644
--- a/target/s390x/vec_helper.c
+++ b/target/s390x/vec_helper.c
@@ -167,3 +167,27 @@ void HELPER(gvec_vperm)(void *v1, const void *v2, const void *v3,
     }
     *(S390Vector *)v1 = tmp;
 }
+
+void HELPER(vstl)(CPUS390XState *env, const void *v1, uint64_t addr,
+                  uint64_t bytes)
+{
+    /* Probe write access before actually modifying memory */
+    probe_write_access(env, addr, bytes, GETPC());
+
+    if (likely(bytes >= 16)) {
+        cpu_stq_data_ra(env, addr, s390_vec_read_element64(v1, 0), GETPC());
+        addr = wrap_address(env, addr + 8);
+        cpu_stq_data_ra(env, addr, s390_vec_read_element64(v1, 1), GETPC());
+    } else {
+        S390Vector tmp = {};
+        int i;
+
+        for (i = 0; i < bytes; i++) {
+            uint8_t byte = s390_vec_read_element8(v1, i);
+
+            cpu_stb_data_ra(env, addr, byte, GETPC());
+            addr = wrap_address(env, addr + 1);
+        }
+        *(S390Vector *)v1 = tmp;
+    }
+}
-- 
2.17.2

  parent reply	other threads:[~2019-03-11  9:06 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-11  9:02 [Qemu-devel] [PULL 00/33] final s390x patches for 4.0 soft freeze Cornelia Huck
2019-03-11  9:02 ` [Qemu-devel] [PULL 01/33] target/s390x: Remove non-architected entries from struct LowCore Cornelia Huck
2019-03-11  9:02 ` [Qemu-devel] [PULL 02/33] s390x/tcg: Define vector instruction formats Cornelia Huck
2019-03-11  9:02 ` [Qemu-devel] [PULL 03/33] s390x/tcg: Check vector register instructions at central point Cornelia Huck
2019-03-11  9:02 ` [Qemu-devel] [PULL 04/33] s390x/tcg: Utilities for vector instruction helpers Cornelia Huck
2019-03-11  9:02 ` [Qemu-devel] [PULL 05/33] s390x/tcg: Implement VECTOR GATHER ELEMENT Cornelia Huck
2019-03-11  9:02 ` [Qemu-devel] [PULL 06/33] s390x/tcg: Implement VECTOR GENERATE BYTE MASK Cornelia Huck
2019-03-11  9:02 ` [Qemu-devel] [PULL 07/33] s390x/tcg: Implement VECTOR GENERATE MASK Cornelia Huck
2019-03-11  9:02 ` [Qemu-devel] [PULL 08/33] s390x/tcg: Implement VECTOR LOAD Cornelia Huck
2019-03-11  9:02 ` [Qemu-devel] [PULL 09/33] s390x/tcg: Implement VECTOR LOAD AND REPLICATE Cornelia Huck
2019-03-11  9:02 ` [Qemu-devel] [PULL 10/33] s390x/tcg: Implement VECTOR LOAD ELEMENT Cornelia Huck
2019-03-11  9:03 ` [Qemu-devel] [PULL 11/33] s390x/tcg: Implement VECTOR LOAD ELEMENT IMMEDIATE Cornelia Huck
2019-03-11  9:03 ` [Qemu-devel] [PULL 12/33] s390x/tcg: Implement VECTOR LOAD GR FROM VR ELEMENT Cornelia Huck
2019-03-11  9:03 ` [Qemu-devel] [PULL 13/33] s390x/tcg: Implement VECTOR LOAD LOGICAL ELEMENT AND ZERO Cornelia Huck
2019-03-11  9:03 ` [Qemu-devel] [PULL 14/33] s390x/tcg: Implement VECTOR LOAD MULTIPLE Cornelia Huck
2019-03-11  9:03 ` [Qemu-devel] [PULL 15/33] s390x/tcg: Implement VECTOR LOAD TO BLOCK BOUNDARY Cornelia Huck
2019-03-11  9:03 ` [Qemu-devel] [PULL 16/33] s390x/tcg: Implement VECTOR LOAD VR ELEMENT FROM GR Cornelia Huck
2019-03-11  9:03 ` [Qemu-devel] [PULL 17/33] s390x/tcg: Implement VECTOR LOAD VR FROM GRS DISJOINT Cornelia Huck
2019-03-11  9:03 ` [Qemu-devel] [PULL 18/33] s390x/tcg: Implement VECTOR LOAD WITH LENGTH Cornelia Huck
2019-03-11  9:03 ` [Qemu-devel] [PULL 19/33] s390x/tcg: Implement VECTOR MERGE (HIGH|LOW) Cornelia Huck
2019-03-11  9:03 ` [Qemu-devel] [PULL 20/33] s390x/tcg: Implement VECTOR PACK * Cornelia Huck
2019-03-11  9:03 ` [Qemu-devel] [PULL 21/33] s390x/tcg: Implement VECTOR PERMUTE Cornelia Huck
2019-03-11  9:03 ` [Qemu-devel] [PULL 22/33] s390x/tcg: Implement VECTOR PERMUTE DOUBLEWORD IMMEDIATE Cornelia Huck
2019-03-11  9:03 ` [Qemu-devel] [PULL 23/33] s390x/tcg: Implement VECTOR REPLICATE Cornelia Huck
2019-03-11  9:03 ` [Qemu-devel] [PULL 24/33] s390x/tcg: Implement VECTOR REPLICATE IMMEDIATE Cornelia Huck
2019-03-11  9:03 ` [Qemu-devel] [PULL 25/33] s390x/tcg: Implement VECTOR SCATTER ELEMENT Cornelia Huck
2019-03-11  9:03 ` [Qemu-devel] [PULL 26/33] s390x/tcg: Implement VECTOR SELECT Cornelia Huck
2019-03-11  9:03 ` [Qemu-devel] [PULL 27/33] s390x/tcg: Implement VECTOR SIGN EXTEND TO DOUBLEWORD Cornelia Huck
2019-03-11  9:03 ` [Qemu-devel] [PULL 28/33] s390x/tcg: Provide probe_write_access helper Cornelia Huck
2019-03-11  9:03 ` [Qemu-devel] [PULL 29/33] s390x/tcg: Implement VECTOR STORE Cornelia Huck
2019-03-11  9:03 ` [Qemu-devel] [PULL 30/33] s390x/tcg: Implement VECTOR STORE ELEMENT Cornelia Huck
2019-03-11  9:03 ` [Qemu-devel] [PULL 31/33] s390x/tcg: Implement VECTOR STORE MULTIPLE Cornelia Huck
2019-03-11  9:03 ` Cornelia Huck [this message]
2019-03-11  9:03 ` [Qemu-devel] [PULL 33/33] s390x/tcg: Implement VECTOR UNPACK * Cornelia Huck
2019-03-11  9:37 ` [Qemu-devel] [PULL 00/33] final s390x patches for 4.0 soft freeze no-reply
2019-03-11 17:16 ` Peter Maydell

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=20190311090322.21603-33-cohuck@redhat.com \
    --to=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@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).