[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[qemu-s390x] [PATCH v3 13/32] s390x/tcg: Implement VECTOR LOAD MULTIPLE
From: |
David Hildenbrand |
Subject: |
[qemu-s390x] [PATCH v3 13/32] s390x/tcg: Implement VECTOR LOAD MULTIPLE |
Date: |
Thu, 7 Mar 2019 13:15:20 +0100 |
Try to load the last element first. Access to the first element will
be checked afterwards. This way, we can guarantee that the vector is
not modified before we checked for all possible exceptions. (16 vectors
cannot cross more than two pages)
Reviewed-by: Richard Henderson <address@hidden>
Signed-off-by: David Hildenbrand <address@hidden>
---
target/s390x/insn-data.def | 2 ++
target/s390x/translate_vx.inc.c | 40 +++++++++++++++++++++++++++++++++
2 files changed, 42 insertions(+)
diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def
index 2b36205c84..fa0f3a9003 100644
--- a/target/s390x/insn-data.def
+++ b/target/s390x/insn-data.def
@@ -1000,6 +1000,8 @@
F(0xe721, VLGV, VRS_c, V, la2, 0, r1, 0, vlgv, 0, IF_VEC)
/* VECTOR LOAD LOGICAL ELEMENT AND ZERO */
F(0xe704, VLLEZ, VRX, V, la2, 0, 0, 0, vllez, 0, IF_VEC)
+/* VECTOR LOAD MULTIPLE */
+ F(0xe736, VLM, VRS_a, V, la2, 0, 0, 0, vlm, 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 cdad2a52f0..083f5c6213 100644
--- a/target/s390x/translate_vx.inc.c
+++ b/target/s390x/translate_vx.inc.c
@@ -406,3 +406,43 @@ static DisasJumpType op_vllez(DisasContext *s, DisasOps *o)
tcg_temp_free_i64(t);
return DISAS_NEXT;
}
+
+static DisasJumpType op_vlm(DisasContext *s, DisasOps *o)
+{
+ const uint8_t v3 = get_field(s->fields, v3);
+ uint8_t v1 = get_field(s->fields, v1);
+ TCGv_i64 t0, t1;
+
+ if (v3 < v1 || (v3 - v1 + 1) > 16) {
+ gen_program_exception(s, PGM_SPECIFICATION);
+ return DISAS_NORETURN;
+ }
+
+ /*
+ * Check for possible access exceptions by trying to load the last
+ * element. The first element will be checked first next.
+ */
+ t0 = tcg_temp_new_i64();
+ t1 = tcg_temp_new_i64();
+ gen_addi_and_wrap_i64(s, t0, o->addr1, (v3 - v1) * 16 + 8);
+ tcg_gen_qemu_ld_i64(t0, t0, get_mem_index(s), MO_TEQ);
+
+ for (;; v1++) {
+ tcg_gen_qemu_ld_i64(t1, o->addr1, get_mem_index(s), MO_TEQ);
+ write_vec_element_i64(t1, v1, 0, ES_64);
+ if (v1 == v3) {
+ break;
+ }
+ gen_addi_and_wrap_i64(s, o->addr1, o->addr1, 8);
+ tcg_gen_qemu_ld_i64(t1, o->addr1, get_mem_index(s), MO_TEQ);
+ write_vec_element_i64(t1, v1, 1, ES_64);
+ gen_addi_and_wrap_i64(s, o->addr1, o->addr1, 8);
+ }
+
+ /* Store the last element, loaded first */
+ write_vec_element_i64(t0, v1, 1, ES_64);
+
+ tcg_temp_free_i64(t0);
+ tcg_temp_free_i64(t1);
+ return DISAS_NEXT;
+}
--
2.17.2
- Re: [qemu-s390x] [Qemu-devel] [PATCH v3 03/32] s390x/tcg: Utilities for vector instruction helpers, (continued)
- [qemu-s390x] [PATCH v3 01/32] s390x/tcg: Define vector instruction formats, David Hildenbrand, 2019/03/07
- [qemu-s390x] [PATCH v3 04/32] s390x/tcg: Implement VECTOR GATHER ELEMENT, David Hildenbrand, 2019/03/07
- [qemu-s390x] [PATCH v3 05/32] s390x/tcg: Implement VECTOR GENERATE BYTE MASK, David Hildenbrand, 2019/03/07
- [qemu-s390x] [PATCH v3 08/32] s390x/tcg: Implement VECTOR LOAD AND REPLICATE, David Hildenbrand, 2019/03/07
- [qemu-s390x] [PATCH v3 06/32] s390x/tcg: Implement VECTOR GENERATE MASK, David Hildenbrand, 2019/03/07
- [qemu-s390x] [PATCH v3 07/32] s390x/tcg: Implement VECTOR LOAD, David Hildenbrand, 2019/03/07
- [qemu-s390x] [PATCH v3 09/32] s390x/tcg: Implement VECTOR LOAD ELEMENT, David Hildenbrand, 2019/03/07
- [qemu-s390x] [PATCH v3 10/32] s390x/tcg: Implement VECTOR LOAD ELEMENT IMMEDIATE, David Hildenbrand, 2019/03/07
- [qemu-s390x] [PATCH v3 12/32] s390x/tcg: Implement VECTOR LOAD LOGICAL ELEMENT AND ZERO, David Hildenbrand, 2019/03/07
- [qemu-s390x] [PATCH v3 13/32] s390x/tcg: Implement VECTOR LOAD MULTIPLE,
David Hildenbrand <=
- [qemu-s390x] [PATCH v3 14/32] s390x/tcg: Implement VECTOR LOAD TO BLOCK BOUNDARY, David Hildenbrand, 2019/03/07
- [qemu-s390x] [PATCH v3 11/32] s390x/tcg: Implement VECTOR LOAD GR FROM VR ELEMENT, David Hildenbrand, 2019/03/07
- [qemu-s390x] [PATCH v3 16/32] s390x/tcg: Implement VECTOR LOAD VR FROM GRS DISJOINT, David Hildenbrand, 2019/03/07
- [qemu-s390x] [PATCH v3 17/32] s390x/tcg: Implement VECTOR LOAD WITH LENGTH, David Hildenbrand, 2019/03/07
- [qemu-s390x] [PATCH v3 18/32] s390x/tcg: Implement VECTOR MERGE (HIGH|LOW), David Hildenbrand, 2019/03/07
- [qemu-s390x] [PATCH v3 15/32] s390x/tcg: Implement VECTOR LOAD VR ELEMENT FROM GR, David Hildenbrand, 2019/03/07
- [qemu-s390x] [PATCH v3 20/32] s390x/tcg: Implement VECTOR PERMUTE, David Hildenbrand, 2019/03/07
- [qemu-s390x] [PATCH v3 21/32] s390x/tcg: Implement VECTOR PERMUTE DOUBLEWORD IMMEDIATE, David Hildenbrand, 2019/03/07
- [qemu-s390x] [PATCH v3 19/32] s390x/tcg: Implement VECTOR PACK *, David Hildenbrand, 2019/03/07
- [qemu-s390x] [PATCH v3 22/32] s390x/tcg: Implement VECTOR REPLICATE, David Hildenbrand, 2019/03/07