qemu-s390x
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[qemu-s390x] [PATCH v1 05/41] s390x/tcg: Implement VECTOR ADD WITH CARRY


From: David Hildenbrand
Subject: [qemu-s390x] [PATCH v1 05/41] s390x/tcg: Implement VECTOR ADD WITH CARRY COMPUTE CARRY
Date: Thu, 11 Apr 2019 12:08:00 +0200

Again, use a helper as calculating the carry is even more involved than
for VECTOR ADD COMPUTE CARRY.

Signed-off-by: David Hildenbrand <address@hidden>
---
 target/s390x/helper.h           |  1 +
 target/s390x/insn-data.def      |  2 ++
 target/s390x/translate_vx.inc.c | 13 +++++++++++++
 target/s390x/vec_int_helper.c   | 16 ++++++++++++++++
 4 files changed, 32 insertions(+)

diff --git a/target/s390x/helper.h b/target/s390x/helper.h
index 2c1b223248..e1847e8877 100644
--- a/target/s390x/helper.h
+++ b/target/s390x/helper.h
@@ -147,6 +147,7 @@ DEF_HELPER_FLAGS_4(vstl, TCG_CALL_NO_WG, void, env, cptr, 
i64, i64)
 
 /* === Vector Integer Instructions === */
 DEF_HELPER_FLAGS_4(gvec_vacc128, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32)
+DEF_HELPER_FLAGS_5(gvec_vaccc128, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, 
cptr, i32)
 
 #ifndef CONFIG_USER_ONLY
 DEF_HELPER_3(servc, i32, env, i64, i64)
diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def
index 38d1e22a6d..a531b21908 100644
--- a/target/s390x/insn-data.def
+++ b/target/s390x/insn-data.def
@@ -1062,6 +1062,8 @@
     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)
+/* VECTOR ADD WITH CARRY COMPUTE CARRY */
+    F(0xe7b9, VACCC,   VRR_d, V,   0, 0, 0, 0, vaccc, 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 111b0b7c69..a264aa0c5a 100644
--- a/target/s390x/translate_vx.inc.c
+++ b/target/s390x/translate_vx.inc.c
@@ -1122,3 +1122,16 @@ static DisasJumpType op_vac(DisasContext *s, DisasOps *o)
                       get_field(s->fields, v4));
     return DISAS_NEXT;
 }
+
+static DisasJumpType op_vaccc(DisasContext *s, DisasOps *o)
+{
+    if (get_field(s->fields, m5) != ES_128) {
+        gen_program_exception(s, PGM_SPECIFICATION);
+        return DISAS_NORETURN;
+    }
+
+    gen_gvec_4_ool(get_field(s->fields, v1), get_field(s->fields, v2),
+                   get_field(s->fields, v3), get_field(s->fields, v4), 0,
+                   gen_helper_gvec_vaccc128);
+    return DISAS_NEXT;
+}
diff --git a/target/s390x/vec_int_helper.c b/target/s390x/vec_int_helper.c
index 0b232571bc..97fc559da0 100644
--- a/target/s390x/vec_int_helper.c
+++ b/target/s390x/vec_int_helper.c
@@ -45,3 +45,19 @@ void HELPER(gvec_vacc128)(void *v1, const void *v2, const 
void *v3,
     dst->doubleword[0] = 0;
     dst->doubleword[1] = s390_vec_add(&tmp, v2, v3);
 }
+
+void HELPER(gvec_vaccc128)(void *v1, const void *v2, const void *v3,
+                           const void *v4, uint32_t desc)
+{
+    const S390Vector old_carry = {
+        .doubleword[0] = 0,
+        .doubleword[1] = ((S390Vector *)v4)->doubleword[1] & 1,
+    };
+    S390Vector tmp, *dst = v1;
+    bool carry;
+
+    carry = s390_vec_add(&tmp, v2, v3);
+    carry |= s390_vec_add(&tmp, &tmp, &old_carry);
+    dst->doubleword[0] = 0;
+    dst->doubleword[1] = carry;
+}
-- 
2.20.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]