[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[qemu-s390x] [PATCH v2 40/41] s390x/tcg: Implement VECTOR SUM ACROSS WOR
From: |
David Hildenbrand |
Subject: |
[qemu-s390x] [PATCH v2 40/41] s390x/tcg: Implement VECTOR SUM ACROSS WORD |
Date: |
Tue, 16 Apr 2019 20:53:00 +0200 |
Similar to VECTOR SUM ACROSS DOUBLEWORD.
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 | 29 +++++++++++++++++++++++++++++
2 files changed, 31 insertions(+)
diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def
index 2483ee01d7..a52db41388 100644
--- a/target/s390x/insn-data.def
+++ b/target/s390x/insn-data.def
@@ -1186,6 +1186,8 @@
F(0xe765, VSUMG, VRR_c, V, 0, 0, 0, 0, vsumg, 0, IF_VEC)
/* VECTOR SUM ACROSS QUADWORD */
F(0xe767, VSUMQ, VRR_c, V, 0, 0, 0, 0, vsumq, 0, IF_VEC)
+/* VECTOR SUM ACROSS WORD */
+ F(0xe764, VSUM, VRR_c, V, 0, 0, 0, 0, vsum, 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 82ab42d2d9..1273bb5ded 100644
--- a/target/s390x/translate_vx.inc.c
+++ b/target/s390x/translate_vx.inc.c
@@ -2366,3 +2366,32 @@ static DisasJumpType op_vsumq(DisasContext *s, DisasOps
*o)
tcg_temp_free_i64(tmpl);
return DISAS_NEXT;
}
+
+static DisasJumpType op_vsum(DisasContext *s, DisasOps *o)
+{
+ const uint8_t es = get_field(s->fields, m4);
+ TCGv_i32 sum, tmp;
+ uint8_t dst_idx;
+
+ if (es > ES_16) {
+ gen_program_exception(s, PGM_SPECIFICATION);
+ return DISAS_NORETURN;
+ }
+
+ sum = tcg_temp_new_i32();
+ tmp = tcg_temp_new_i32();
+ for (dst_idx = 0; dst_idx < 4; dst_idx++) {
+ uint8_t idx = dst_idx * NUM_VEC_ELEMENTS(es) / 4;
+ const uint8_t max_idx = idx + NUM_VEC_ELEMENTS(es) / 4 - 1;
+
+ read_vec_element_i32(sum, get_field(s->fields, v3), max_idx, es);
+ for (; idx <= max_idx; idx++) {
+ read_vec_element_i32(tmp, get_field(s->fields, v2), idx, es);
+ tcg_gen_add_i32(sum, sum, tmp);
+ }
+ write_vec_element_i32(sum, get_field(s->fields, v1), dst_idx, ES_32);
+ }
+ tcg_temp_free_i32(sum);
+ tcg_temp_free_i32(tmp);
+ return DISAS_NEXT;
+}
--
2.20.1
- [qemu-s390x] [PATCH v2 32/41] s390x/tcg: Implement VECTOR SHIFT RIGHT ARITHMETIC, (continued)
- [qemu-s390x] [PATCH v2 32/41] s390x/tcg: Implement VECTOR SHIFT RIGHT ARITHMETIC, David Hildenbrand, 2019/04/16
- [qemu-s390x] [PATCH v2 34/41] s390x/tcg: Implement VECTOR SUBTRACT, David Hildenbrand, 2019/04/16
- [qemu-s390x] [PATCH v2 33/41] s390x/tcg: Implement VECTOR SHIFT RIGHT LOGICAL *, David Hildenbrand, 2019/04/16
- [qemu-s390x] [PATCH v2 35/41] s390x/tcg: Implement VECTOR SUBTRACT COMPUTE BORROW INDICATION, David Hildenbrand, 2019/04/16
- [qemu-s390x] [PATCH v2 36/41] s390x/tcg: Implement VECTOR SUBTRACT WITH BORROW INDICATION, David Hildenbrand, 2019/04/16
- [qemu-s390x] [PATCH v2 37/41] s390x/tcg: Implement VECTOR SUBTRACT WITH BORROW COMPUTE BORROW INDICATION, David Hildenbrand, 2019/04/16
- [qemu-s390x] [PATCH v2 38/41] s390x/tcg: Implement VECTOR SUM ACROSS DOUBLEWORD, David Hildenbrand, 2019/04/16
- [qemu-s390x] [PATCH v2 39/41] s390x/tcg: Implement VECTOR SUM ACROSS QUADWORD, David Hildenbrand, 2019/04/16
- [qemu-s390x] [PATCH v2 40/41] s390x/tcg: Implement VECTOR SUM ACROSS WORD,
David Hildenbrand <=
- [qemu-s390x] [PATCH v2 41/41] s390x/tcg: Implement VECTOR TEST UNDER MASK, David Hildenbrand, 2019/04/16
- Re: [qemu-s390x] [PATCH v2 00/41] s390x/tcg: Vector Instruction Support Part 2, Cornelia Huck, 2019/04/17