[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[qemu-s390x] [PATCH v2 06/32] s390x/tcg: Implement VECTOR GENERATE MASK
From: |
David Hildenbrand |
Subject: |
[qemu-s390x] [PATCH v2 06/32] s390x/tcg: Implement VECTOR GENERATE MASK |
Date: |
Fri, 1 Mar 2019 12:53:47 +0100 |
Add gen_gvec_dupi() for handling duplication of immediates, so it can
be reused later.
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 | 47 +++++++++++++++++++++++++++++++++
2 files changed, 49 insertions(+)
diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def
index d3f66c858f..c8cd5dfa24 100644
--- a/target/s390x/insn-data.def
+++ b/target/s390x/insn-data.def
@@ -979,6 +979,8 @@
E(0xe712, VGEG, VRV, V, la2, 0, 0, 0, vge, 0, ES_64, IF_VEC)
/* VECTOR GENERATE BYTE MASK */
F(0xe744, VGBM, VRI_a, V, 0, 0, 0, 0, vgbm, 0, IF_VEC)
+/* VECTOR GENERATE MASK */
+ F(0xe746, VGM, VRI_b, V, 0, 0, 0, 0, vgm, 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 395c0ebcc2..28edd9b0c4 100644
--- a/target/s390x/translate_vx.inc.c
+++ b/target/s390x/translate_vx.inc.c
@@ -44,6 +44,7 @@
#define NUM_VEC_ELEMENT_BYTES(es) (1 << (es))
#define NUM_VEC_ELEMENTS(es) (16 / NUM_VEC_ELEMENT_BYTES(es))
+#define NUM_VEC_ELEMENT_BITS(es) (NUM_VEC_ELEMENT_BYTES(es) * BITS_PER_BYTE)
#define ES_8 MO_8
#define ES_16 MO_16
@@ -115,6 +116,26 @@ static void write_vec_element_i64(TCGv_i64 src, int reg,
uint8_t enr,
#define gen_gvec_dup64i(v1, c) \
tcg_gen_gvec_dup64i(vec_full_reg_offset(v1), 16, 16, c)
+static void gen_gvec_dupi(uint8_t es, uint8_t reg, uint64_t c)
+{
+ switch (es) {
+ case ES_8:
+ tcg_gen_gvec_dup8i(vec_full_reg_offset(reg), 16, 16, c);
+ break;
+ case ES_16:
+ tcg_gen_gvec_dup16i(vec_full_reg_offset(reg), 16, 16, c);
+ break;
+ case ES_32:
+ tcg_gen_gvec_dup32i(vec_full_reg_offset(reg), 16, 16, c);
+ break;
+ case ES_64:
+ gen_gvec_dup64i(reg, c);
+ break;
+ default:
+ g_assert_not_reached();
+ }
+}
+
static DisasJumpType op_vge(DisasContext *s, DisasOps *o)
{
const uint8_t es = s->insn->data;
@@ -172,3 +193,29 @@ static DisasJumpType op_vgbm(DisasContext *s, DisasOps *o)
}
return DISAS_NEXT;
}
+
+static DisasJumpType op_vgm(DisasContext *s, DisasOps *o)
+{
+ const uint8_t es = get_field(s->fields, m4);
+ const uint8_t bits = NUM_VEC_ELEMENT_BITS(es);
+ const uint8_t i2 = get_field(s->fields, i2) & (bits - 1);
+ const uint8_t i3 = get_field(s->fields, i3) & (bits - 1);
+ uint64_t mask = 0;
+ int i;
+
+ if (es > ES_64) {
+ gen_program_exception(s, PGM_SPECIFICATION);
+ return DISAS_NORETURN;
+ }
+
+ /* generate the mask - take care of wrapping */
+ for (i = i2; ; i = (i + 1) % bits) {
+ mask |= 1ull << (bits - i - 1);
+ if (i == i3) {
+ break;
+ }
+ }
+
+ gen_gvec_dupi(es, get_field(s->fields, v1), mask);
+ return DISAS_NEXT;
+}
--
2.17.2
- Re: [qemu-s390x] [Qemu-devel] [PATCH v2 03/32] s390x/tcg: Utilities for vector instruction helpers, (continued)
[qemu-s390x] [PATCH v2 04/32] s390x/tcg: Implement VECTOR GATHER ELEMENT, David Hildenbrand, 2019/03/01
[qemu-s390x] [PATCH v2 05/32] s390x/tcg: Implement VECTOR GENERATE BYTE MASK, David Hildenbrand, 2019/03/01
[qemu-s390x] [PATCH v2 07/32] s390x/tcg: Implement VECTOR LOAD, David Hildenbrand, 2019/03/01
[qemu-s390x] [PATCH v2 06/32] s390x/tcg: Implement VECTOR GENERATE MASK,
David Hildenbrand <=
[qemu-s390x] [PATCH v2 09/32] s390x/tcg: Implement VECTOR LOAD ELEMENT, David Hildenbrand, 2019/03/01
[qemu-s390x] [PATCH v2 08/32] s390x/tcg: Implement VECTOR LOAD AND REPLICATE, David Hildenbrand, 2019/03/01
[qemu-s390x] [PATCH v2 10/32] s390x/tcg: Implement VECTOR LOAD ELEMENT IMMEDIATE, David Hildenbrand, 2019/03/01
[qemu-s390x] [PATCH v2 11/32] s390x/tcg: Implement VECTOR LOAD GR FROM VR ELEMENT, David Hildenbrand, 2019/03/01
[qemu-s390x] [PATCH v2 13/32] s390x/tcg: Implement VECTOR LOAD MULTIPLE, David Hildenbrand, 2019/03/01
[qemu-s390x] [PATCH v2 12/32] s390x/tcg: Implement VECTOR LOAD LOGICAL ELEMENT AND ZERO, David Hildenbrand, 2019/03/01