[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[qemu-s390x] [PULL v2 27/34] s390x/tcg: Implement VECTOR FP SQUARE ROOT
From: |
Cornelia Huck |
Subject: |
[qemu-s390x] [PULL v2 27/34] s390x/tcg: Implement VECTOR FP SQUARE ROOT |
Date: |
Fri, 7 Jun 2019 16:17:20 +0200 |
From: David Hildenbrand <address@hidden>
Simulate XxC=0 and ERM=0 (current mode), so we can use the existing
helper function.
Reviewed-by: Richard Henderson <address@hidden>
Signed-off-by: David Hildenbrand <address@hidden>
---
target/s390x/helper.h | 2 ++
target/s390x/insn-data.def | 2 ++
target/s390x/translate_vx.inc.c | 19 +++++++++++++++++++
target/s390x/vec_fpu_helper.c | 17 +++++++++++++++++
4 files changed, 40 insertions(+)
diff --git a/target/s390x/helper.h b/target/s390x/helper.h
index bcaabb91a510..23b37af1e492 100644
--- a/target/s390x/helper.h
+++ b/target/s390x/helper.h
@@ -288,6 +288,8 @@ DEF_HELPER_FLAGS_6(gvec_vfma64, TCG_CALL_NO_WG, void, ptr,
cptr, cptr, cptr, env
DEF_HELPER_FLAGS_6(gvec_vfma64s, TCG_CALL_NO_WG, void, ptr, cptr, cptr, cptr,
env, i32)
DEF_HELPER_FLAGS_6(gvec_vfms64, TCG_CALL_NO_WG, void, ptr, cptr, cptr, cptr,
env, i32)
DEF_HELPER_FLAGS_6(gvec_vfms64s, TCG_CALL_NO_WG, void, ptr, cptr, cptr, cptr,
env, i32)
+DEF_HELPER_FLAGS_4(gvec_vfsq64, TCG_CALL_NO_WG, void, ptr, cptr, env, i32)
+DEF_HELPER_FLAGS_4(gvec_vfsq64s, TCG_CALL_NO_WG, void, ptr, cptr, env, 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 fa2e8017470e..354252d57cc0 100644
--- a/target/s390x/insn-data.def
+++ b/target/s390x/insn-data.def
@@ -1242,6 +1242,8 @@
F(0xe78e, VFMS, VRR_e, V, 0, 0, 0, 0, vfma, 0, IF_VEC)
/* VECTOR FP PERFORM SIGN OPERATION */
F(0xe7cc, VFPSO, VRR_a, V, 0, 0, 0, 0, vfpso, 0, IF_VEC)
+/* VECTOR FP SQUARE ROOT */
+ F(0xe7ce, VFSQ, VRR_a, V, 0, 0, 0, 0, vfsq, 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 9b8606ba252c..75f3596c4baa 100644
--- a/target/s390x/translate_vx.inc.c
+++ b/target/s390x/translate_vx.inc.c
@@ -2779,3 +2779,22 @@ static DisasJumpType op_vfpso(DisasContext *s, DisasOps
*o)
}
return DISAS_NEXT;
}
+
+static DisasJumpType op_vfsq(DisasContext *s, DisasOps *o)
+{
+ const uint8_t fpf = get_field(s->fields, m3);
+ const uint8_t m4 = get_field(s->fields, m4);
+ gen_helper_gvec_2_ptr *fn = gen_helper_gvec_vfsq64;
+
+ if (fpf != FPF_LONG || extract32(m4, 0, 3)) {
+ gen_program_exception(s, PGM_SPECIFICATION);
+ return DISAS_NORETURN;
+ }
+
+ if (extract32(m4, 3, 1)) {
+ fn = gen_helper_gvec_vfsq64s;
+ }
+ gen_gvec_2_ptr(get_field(s->fields, v1), get_field(s->fields, v2), cpu_env,
+ 0, fn);
+ return DISAS_NEXT;
+}
diff --git a/target/s390x/vec_fpu_helper.c b/target/s390x/vec_fpu_helper.c
index 7993a6fafa41..18773eb559d4 100644
--- a/target/s390x/vec_fpu_helper.c
+++ b/target/s390x/vec_fpu_helper.c
@@ -552,3 +552,20 @@ void HELPER(gvec_vfms64s)(void *v1, const void *v2, const
void *v3,
{
vfma64(v1, v2, v3, v4, env, true, float_muladd_negate_c, GETPC());
}
+
+static uint64_t vfsq64(uint64_t a, float_status *s)
+{
+ return float64_sqrt(a, s);
+}
+
+void HELPER(gvec_vfsq64)(void *v1, const void *v2, CPUS390XState *env,
+ uint32_t desc)
+{
+ vop64_2(v1, v2, env, false, false, 0, vfsq64, GETPC());
+}
+
+void HELPER(gvec_vfsq64s)(void *v1, const void *v2, CPUS390XState *env,
+ uint32_t desc)
+{
+ vop64_2(v1, v2, env, true, false, 0, vfsq64, GETPC());
+}
--
2.20.1
- [qemu-s390x] [PULL v2 16/34] s390x/tcg: Implement VECTOR FP CONVERT FROM FIXED 64-BIT, (continued)
- [qemu-s390x] [PULL v2 16/34] s390x/tcg: Implement VECTOR FP CONVERT FROM FIXED 64-BIT, Cornelia Huck, 2019/06/07
- [qemu-s390x] [PULL v2 17/34] s390x/tcg: Implement VECTOR FP CONVERT FROM LOGICAL 64-BIT, Cornelia Huck, 2019/06/07
- [qemu-s390x] [PULL v2 18/34] s390x/tcg: Implement VECTOR FP CONVERT TO FIXED 64-BIT, Cornelia Huck, 2019/06/07
- [qemu-s390x] [PULL v2 19/34] s390x/tcg: Implement VECTOR FP CONVERT TO LOGICAL 64-BIT, Cornelia Huck, 2019/06/07
- [qemu-s390x] [PULL v2 20/34] s390x/tcg: Implement VECTOR FP DIVIDE, Cornelia Huck, 2019/06/07
- [qemu-s390x] [PULL v2 21/34] s390x/tcg: Implement VECTOR LOAD FP INTEGER, Cornelia Huck, 2019/06/07
- [qemu-s390x] [PULL v2 22/34] s390x/tcg: Implement VECTOR LOAD LENGTHENED, Cornelia Huck, 2019/06/07
- [qemu-s390x] [PULL v2 24/34] s390x/tcg: Implement VECTOR FP MULTIPLY, Cornelia Huck, 2019/06/07
- [qemu-s390x] [PULL v2 23/34] s390x/tcg: Implement VECTOR LOAD ROUNDED, Cornelia Huck, 2019/06/07
- [qemu-s390x] [PULL v2 25/34] s390x/tcg: Implement VECTOR FP MULTIPLY AND (ADD|SUBTRACT), Cornelia Huck, 2019/06/07
- [qemu-s390x] [PULL v2 27/34] s390x/tcg: Implement VECTOR FP SQUARE ROOT,
Cornelia Huck <=
- [qemu-s390x] [PULL v2 28/34] s390x/tcg: Implement VECTOR FP SUBTRACT, Cornelia Huck, 2019/06/07
- [qemu-s390x] [PULL v2 26/34] s390x/tcg: Implement VECTOR FP PERFORM SIGN OPERATION, Cornelia Huck, 2019/06/07
- [qemu-s390x] [PULL v2 29/34] s390x/tcg: Implement VECTOR FP TEST DATA CLASS IMMEDIATE, Cornelia Huck, 2019/06/07
- [qemu-s390x] [PULL v2 31/34] s390x/tcg: We support the Vector Facility, Cornelia Huck, 2019/06/07
- [qemu-s390x] [PULL v2 30/34] s390x/tcg: Allow linux-user to use vector instructions, Cornelia Huck, 2019/06/07
- [qemu-s390x] [PULL v2 32/34] s390x: Bump the "qemu" CPU model up to a stripped-down z13, Cornelia Huck, 2019/06/07
- [qemu-s390x] [PULL v2 33/34] s390x/tcg: Use tcg_gen_gvec_bitsel for VECTOR SELECT, Cornelia Huck, 2019/06/07
- [qemu-s390x] [PULL v2 34/34] linux-user: elf: ELF_HWCAP for s390x, Cornelia Huck, 2019/06/07
- Re: [qemu-s390x] [PULL v2 00/34] s390x updates, Peter Maydell, 2019/06/07