[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL SUBSYSTEM s390x 03/40] s390x/tcg: Implement VECTOR AD
From: |
David Hildenbrand |
Subject: |
[Qemu-devel] [PULL SUBSYSTEM s390x 03/40] s390x/tcg: Implement VECTOR ADD WITH CARRY |
Date: |
Fri, 17 May 2019 12:21:08 +0200 |
Only slightly ugly, perform two additions. At least it is only supported
for 128 bit elements.
Introduce gen_gvec128_4_i64() similar to gen_gvec128_3_i64().
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 | 63 +++++++++++++++++++++++++++++++++
2 files changed, 65 insertions(+)
diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def
index f0e62b9aa8..38d1e22a6d 100644
--- a/target/s390x/insn-data.def
+++ b/target/s390x/insn-data.def
@@ -1060,6 +1060,8 @@
F(0xe7f3, VA, VRR_c, V, 0, 0, 0, 0, va, 0, IF_VEC)
/* VECTOR ADD COMPUTE CARRY */
F(0xe7f1, VACC, VRR_c, V, 0, 0, 0, 0, vacc, 0, IF_VEC)
+/* VECTOR ADD WITH CARRY */
+ F(0xe7bb, VAC, VRR_d, V, 0, 0, 0, 0, vac, 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 a97fce5b65..d3d3442c0d 100644
--- a/target/s390x/translate_vx.inc.c
+++ b/target/s390x/translate_vx.inc.c
@@ -196,6 +196,41 @@ static void gen_gvec128_3_i64(gen_gvec128_3_i64_fn fn,
uint8_t d, uint8_t a,
tcg_temp_free_i64(bl);
}
+typedef void (*gen_gvec128_4_i64_fn)(TCGv_i64 dl, TCGv_i64 dh, TCGv_i64 al,
+ TCGv_i64 ah, TCGv_i64 bl, TCGv_i64 bh,
+ TCGv_i64 cl, TCGv_i64 ch);
+static void gen_gvec128_4_i64(gen_gvec128_4_i64_fn fn, uint8_t d, uint8_t a,
+ uint8_t b, uint8_t c)
+{
+ TCGv_i64 dh = tcg_temp_new_i64();
+ TCGv_i64 dl = tcg_temp_new_i64();
+ TCGv_i64 ah = tcg_temp_new_i64();
+ TCGv_i64 al = tcg_temp_new_i64();
+ TCGv_i64 bh = tcg_temp_new_i64();
+ TCGv_i64 bl = tcg_temp_new_i64();
+ TCGv_i64 ch = tcg_temp_new_i64();
+ TCGv_i64 cl = tcg_temp_new_i64();
+
+ read_vec_element_i64(ah, a, 0, ES_64);
+ read_vec_element_i64(al, a, 1, ES_64);
+ read_vec_element_i64(bh, b, 0, ES_64);
+ read_vec_element_i64(bl, b, 1, ES_64);
+ read_vec_element_i64(ch, c, 0, ES_64);
+ read_vec_element_i64(cl, c, 1, ES_64);
+ fn(dl, dh, al, ah, bl, bh, cl, ch);
+ write_vec_element_i64(dh, d, 0, ES_64);
+ write_vec_element_i64(dl, d, 1, ES_64);
+
+ tcg_temp_free_i64(dh);
+ tcg_temp_free_i64(dl);
+ tcg_temp_free_i64(ah);
+ tcg_temp_free_i64(al);
+ tcg_temp_free_i64(bh);
+ tcg_temp_free_i64(bl);
+ tcg_temp_free_i64(ch);
+ tcg_temp_free_i64(cl);
+}
+
static void gen_gvec_dupi(uint8_t es, uint8_t reg, uint64_t c)
{
switch (es) {
@@ -1083,3 +1118,31 @@ static DisasJumpType op_vacc(DisasContext *s, DisasOps
*o)
get_field(s->fields, v3), &g[es]);
return DISAS_NEXT;
}
+
+static void gen_ac2_i64(TCGv_i64 dl, TCGv_i64 dh, TCGv_i64 al, TCGv_i64 ah,
+ TCGv_i64 bl, TCGv_i64 bh, TCGv_i64 cl, TCGv_i64 ch)
+{
+ TCGv_i64 tl = tcg_temp_new_i64();
+ TCGv_i64 th = tcg_const_i64(0);
+
+ /* extract the carry only */
+ tcg_gen_extract_i64(tl, cl, 0, 1);
+ tcg_gen_add2_i64(dl, dh, al, ah, bl, bh);
+ tcg_gen_add2_i64(dl, dh, dl, dh, tl, th);
+
+ tcg_temp_free_i64(tl);
+ tcg_temp_free_i64(th);
+}
+
+static DisasJumpType op_vac(DisasContext *s, DisasOps *o)
+{
+ if (get_field(s->fields, m5) != ES_128) {
+ gen_program_exception(s, PGM_SPECIFICATION);
+ return DISAS_NORETURN;
+ }
+
+ gen_gvec128_4_i64(gen_ac2_i64, get_field(s->fields, v1),
+ get_field(s->fields, v2), get_field(s->fields, v3),
+ get_field(s->fields, v4));
+ return DISAS_NEXT;
+}
--
2.20.1
- [Qemu-devel] [PULL SUBSYSTEM s390x 12/40] s390x/tcg: Implement VECTOR COUNT TRAILING ZEROS, (continued)
- [Qemu-devel] [PULL SUBSYSTEM s390x 12/40] s390x/tcg: Implement VECTOR COUNT TRAILING ZEROS, David Hildenbrand, 2019/05/17
- [Qemu-devel] [PULL SUBSYSTEM s390x 13/40] s390x/tcg: Implement VECTOR EXCLUSIVE OR, David Hildenbrand, 2019/05/17
- [Qemu-devel] [PULL SUBSYSTEM s390x 10/40] s390x/tcg: Implement VECTOR COMPARE *, David Hildenbrand, 2019/05/17
- [Qemu-devel] [PULL SUBSYSTEM s390x 11/40] s390x/tcg: Implement VECTOR COUNT LEADING ZEROS, David Hildenbrand, 2019/05/17
- [Qemu-devel] [PULL SUBSYSTEM s390x 08/40] s390x/tcg: Implement VECTOR CHECKSUM, David Hildenbrand, 2019/05/17
- [Qemu-devel] [PULL SUBSYSTEM s390x 09/40] s390x/tcg: Implement VECTOR ELEMENT COMPARE *, David Hildenbrand, 2019/05/17
- [Qemu-devel] [PULL SUBSYSTEM s390x 05/40] s390x/tcg: Implement VECTOR AND (WITH COMPLEMENT), David Hildenbrand, 2019/05/17
- [Qemu-devel] [PULL SUBSYSTEM s390x 06/40] s390x/tcg: Implement VECTOR AVERAGE, David Hildenbrand, 2019/05/17
- [Qemu-devel] [PULL SUBSYSTEM s390x 04/40] s390x/tcg: Implement VECTOR ADD WITH CARRY COMPUTE CARRY, David Hildenbrand, 2019/05/17
- [Qemu-devel] [PULL SUBSYSTEM s390x 07/40] s390x/tcg: Implement VECTOR AVERAGE LOGICAL, David Hildenbrand, 2019/05/17
- [Qemu-devel] [PULL SUBSYSTEM s390x 03/40] s390x/tcg: Implement VECTOR ADD WITH CARRY,
David Hildenbrand <=
- [Qemu-devel] [PULL SUBSYSTEM s390x 01/40] s390x/tcg: Implement VECTOR ADD, David Hildenbrand, 2019/05/17
- [Qemu-devel] [PULL SUBSYSTEM s390x 02/40] s390x/tcg: Implement VECTOR ADD COMPUTE CARRY, David Hildenbrand, 2019/05/17