[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[qemu-s390x] [PATCH v3 18/32] s390x/tcg: Implement VECTOR MERGE (HIGH|LO
From: |
David Hildenbrand |
Subject: |
[qemu-s390x] [PATCH v3 18/32] s390x/tcg: Implement VECTOR MERGE (HIGH|LOW) |
Date: |
Thu, 7 Mar 2019 13:15:25 +0100 |
We cannot use gvec expansion as source and destination elements are
have different element numbers. So we'll expand using a fancy loop.
Also, we have to take care of overlapping source and destination
registers, therefore use a safe evaluation irder depending on the
operation.
Reviewed-by: Richard Henderson <address@hidden>
Signed-off-by: David Hildenbrand <address@hidden>
---
target/s390x/insn-data.def | 4 ++++
target/s390x/translate_vx.inc.c | 42 +++++++++++++++++++++++++++++++++
2 files changed, 46 insertions(+)
diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def
index 3c0b14bafd..f7232f8615 100644
--- a/target/s390x/insn-data.def
+++ b/target/s390x/insn-data.def
@@ -1010,6 +1010,10 @@
F(0xe762, VLVGP, VRR_f, V, r2, r3, 0, 0, vlvgp, 0, IF_VEC)
/* VECTOR LOAD WITH LENGTH */
F(0xe737, VLL, VRS_b, V, la2, r3_32u, 0, 0, vll, 0, IF_VEC)
+/* VECTOR MERGE HIGH */
+ F(0xe761, VMRH, VRR_c, V, 0, 0, 0, 0, vmr, 0, IF_VEC)
+/* VECTOR MERGE LOW */
+ F(0xe760, VMRL, VRR_c, V, 0, 0, 0, 0, vmr, 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 b8e69856cd..9c2cf8a77b 100644
--- a/target/s390x/translate_vx.inc.c
+++ b/target/s390x/translate_vx.inc.c
@@ -532,3 +532,45 @@ static DisasJumpType op_vll(DisasContext *s, DisasOps *o)
tcg_temp_free_ptr(a0);
return DISAS_NEXT;
}
+
+static DisasJumpType op_vmr(DisasContext *s, DisasOps *o)
+{
+ const uint8_t v1 = get_field(s->fields, v1);
+ const uint8_t v2 = get_field(s->fields, v2);
+ const uint8_t v3 = get_field(s->fields, v3);
+ const uint8_t es = get_field(s->fields, m4);
+ int dst_idx, src_idx;
+ TCGv_i64 tmp;
+
+ if (es > ES_64) {
+ gen_program_exception(s, PGM_SPECIFICATION);
+ return DISAS_NORETURN;
+ }
+
+ tmp = tcg_temp_new_i64();
+ if (s->fields->op2 == 0x61) {
+ /* iterate backwards to avoid overwriting data we might need later */
+ for (dst_idx = NUM_VEC_ELEMENTS(es) - 1; dst_idx >= 0; dst_idx--) {
+ src_idx = dst_idx / 2;
+ if (dst_idx % 2 == 0) {
+ read_vec_element_i64(tmp, v2, src_idx, es);
+ } else {
+ read_vec_element_i64(tmp, v3, src_idx, es);
+ }
+ write_vec_element_i64(tmp, v1, dst_idx, es);
+ }
+ } else {
+ /* iterate forward to avoid overwriting data we might need later */
+ for (dst_idx = 0; dst_idx < NUM_VEC_ELEMENTS(es); dst_idx++) {
+ src_idx = (dst_idx + NUM_VEC_ELEMENTS(es)) / 2;
+ if (dst_idx % 2 == 0) {
+ read_vec_element_i64(tmp, v2, src_idx, es);
+ } else {
+ read_vec_element_i64(tmp, v3, src_idx, es);
+ }
+ write_vec_element_i64(tmp, v1, dst_idx, es);
+ }
+ }
+ tcg_temp_free_i64(tmp);
+ return DISAS_NEXT;
+}
--
2.17.2
- [qemu-s390x] [PATCH v3 06/32] s390x/tcg: Implement VECTOR GENERATE MASK, (continued)
- [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, 2019/03/07
- [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 <=
- [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
- [qemu-s390x] [PATCH v3 23/32] s390x/tcg: Implement VECTOR REPLICATE IMMEDIATE, David Hildenbrand, 2019/03/07
- [qemu-s390x] [PATCH v3 24/32] s390x/tcg: Implement VECTOR SCATTER ELEMENT, David Hildenbrand, 2019/03/07
- [qemu-s390x] [PATCH v3 25/32] s390x/tcg: Implement VECTOR SELECT, David Hildenbrand, 2019/03/07
- [qemu-s390x] [PATCH v3 26/32] s390x/tcg: Implement VECTOR SIGN EXTEND TO DOUBLEWORD, David Hildenbrand, 2019/03/07
- [qemu-s390x] [PATCH v3 28/32] s390x/tcg: Implement VECTOR STORE, David Hildenbrand, 2019/03/07