[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 17/23] target/ppc: implement xscvqp[su]qz
From: |
Daniel Henrique Barboza |
Subject: |
[PULL 17/23] target/ppc: implement xscvqp[su]qz |
Date: |
Wed, 20 Apr 2022 19:13:23 -0300 |
From: Matheus Ferst <matheus.ferst@eldorado.org.br>
Implement the following PowerISA v3.1 instructions:
xscvqpsqz: VSX Scalar Convert with round to zero Quad-Precision to
Signed Quadword
xscvqpuqz: VSX Scalar Convert with round to zero Quad-Precision to
Unsigned Quadword
Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220330175932.6995-9-matheus.ferst@eldorado.org.br>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
---
target/ppc/fpu_helper.c | 21 +++++++++++++++++++++
target/ppc/helper.h | 2 ++
target/ppc/insn32.decode | 2 ++
target/ppc/translate/vsx-impl.c.inc | 2 ++
4 files changed, 27 insertions(+)
diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c
index 97892afa95..99281cc37a 100644
--- a/target/ppc/fpu_helper.c
+++ b/target/ppc/fpu_helper.c
@@ -2925,6 +2925,27 @@ VSX_CVT_FP_TO_INT(xvcvspsxws, 4, float32, int32,
VsrW(i), VsrW(i), 0x80000000U)
VSX_CVT_FP_TO_INT(xvcvspuxds, 2, float32, uint64, VsrW(2 * i), VsrD(i), 0ULL)
VSX_CVT_FP_TO_INT(xvcvspuxws, 4, float32, uint32, VsrW(i), VsrW(i), 0U)
+#define VSX_CVT_FP_TO_INT128(op, tp, rnan)
\
+void helper_##op(CPUPPCState *env, ppc_vsr_t *xt, ppc_vsr_t *xb)
\
+{
\
+ ppc_vsr_t t;
\
+ int flags;
\
+
\
+ helper_reset_fpstatus(env);
\
+ t.s128 = float128_to_##tp##_round_to_zero(xb->f128, &env->fp_status);
\
+ flags = get_float_exception_flags(&env->fp_status);
\
+ if (unlikely(flags & float_flag_invalid)) {
\
+ t.VsrD(0) = float_invalid_cvt(env, flags, t.VsrD(0), rnan, 0,
GETPC());\
+ t.VsrD(1) = -(t.VsrD(0) & 1);
\
+ }
\
+
\
+ *xt = t;
\
+ do_float_check_status(env, GETPC());
\
+}
+
+VSX_CVT_FP_TO_INT128(XSCVQPUQZ, uint128, 0)
+VSX_CVT_FP_TO_INT128(XSCVQPSQZ, int128, 0x8000000000000000ULL);
+
/*
* Likewise, except that the result is duplicated into both subwords.
* Power ISA v3.1 has Programming Notes for these insns:
diff --git a/target/ppc/helper.h b/target/ppc/helper.h
index 7df0c01819..aa6773c4a5 100644
--- a/target/ppc/helper.h
+++ b/target/ppc/helper.h
@@ -388,6 +388,8 @@ DEF_HELPER_4(xscvqpsdz, void, env, i32, vsr, vsr)
DEF_HELPER_4(xscvqpswz, void, env, i32, vsr, vsr)
DEF_HELPER_4(xscvqpudz, void, env, i32, vsr, vsr)
DEF_HELPER_4(xscvqpuwz, void, env, i32, vsr, vsr)
+DEF_HELPER_3(XSCVQPUQZ, void, env, vsr, vsr)
+DEF_HELPER_3(XSCVQPSQZ, void, env, vsr, vsr)
DEF_HELPER_3(XSCVUQQP, void, env, vsr, vsr)
DEF_HELPER_3(XSCVSQQP, void, env, vsr, vsr)
DEF_HELPER_3(xscvhpdp, void, env, vsr, vsr)
diff --git a/target/ppc/insn32.decode b/target/ppc/insn32.decode
index 6fb568c1fe..39372fe673 100644
--- a/target/ppc/insn32.decode
+++ b/target/ppc/insn32.decode
@@ -695,6 +695,8 @@ XSCMPGTQP 111111 ..... ..... ..... 0011100100 - @X
## VSX Binary Floating-Point Convert Instructions
XSCVQPDP 111111 ..... 10100 ..... 1101000100 . @X_tb_rc
+XSCVQPUQZ 111111 ..... 00000 ..... 1101000100 - @X_tb
+XSCVQPSQZ 111111 ..... 01000 ..... 1101000100 - @X_tb
XSCVUQQP 111111 ..... 00011 ..... 1101000100 - @X_tb
XSCVSQQP 111111 ..... 01011 ..... 1101000100 - @X_tb
XVCVBF16SPN 111100 ..... 10000 ..... 111011011 .. @XX2
diff --git a/target/ppc/translate/vsx-impl.c.inc
b/target/ppc/translate/vsx-impl.c.inc
index bda681e65c..3692740736 100644
--- a/target/ppc/translate/vsx-impl.c.inc
+++ b/target/ppc/translate/vsx-impl.c.inc
@@ -857,6 +857,8 @@ static bool do_helper_env_X_tb(DisasContext *ctx, arg_X_tb
*a,
TRANS(XSCVUQQP, do_helper_env_X_tb, gen_helper_XSCVUQQP)
TRANS(XSCVSQQP, do_helper_env_X_tb, gen_helper_XSCVSQQP)
+TRANS(XSCVQPUQZ, do_helper_env_X_tb, gen_helper_XSCVQPUQZ)
+TRANS(XSCVQPSQZ, do_helper_env_X_tb, gen_helper_XSCVQPSQZ)
#define GEN_VSX_HELPER_2(name, op1, op2, inval, type) \
static void gen_##name(DisasContext *ctx) \
--
2.35.1
- [PULL 07/23] ppc/pnv: Remove useless checks in set_irq handlers, (continued)
- [PULL 07/23] ppc/pnv: Remove useless checks in set_irq handlers, Daniel Henrique Barboza, 2022/04/20
- [PULL 08/23] spapr: Move hypercall_register_softmmu, Daniel Henrique Barboza, 2022/04/20
- [PULL 09/23] spapr: Move nested KVM hypercalls under a TCG only config., Daniel Henrique Barboza, 2022/04/20
- [PULL 10/23] target/ppc: Improve KVM hypercall trace, Daniel Henrique Barboza, 2022/04/20
- [PULL 11/23] qemu/int128: add int128_urshift, Daniel Henrique Barboza, 2022/04/20
- [PULL 12/23] softfloat: add uint128_to_float128, Daniel Henrique Barboza, 2022/04/20
- [PULL 13/23] softfloat: add int128_to_float128, Daniel Henrique Barboza, 2022/04/20
- [PULL 14/23] softfloat: add float128_to_uint128, Daniel Henrique Barboza, 2022/04/20
- [PULL 15/23] softfloat: add float128_to_int128, Daniel Henrique Barboza, 2022/04/20
- [PULL 16/23] target/ppc: implement xscv[su]qqp, Daniel Henrique Barboza, 2022/04/20
- [PULL 17/23] target/ppc: implement xscvqp[su]qz,
Daniel Henrique Barboza <=
- [PULL 18/23] hw/ppc/ppc405_boards: Initialize g_autofree pointer, Daniel Henrique Barboza, 2022/04/20
- [PULL 19/23] ppc/vof: Fix uninitialized string tracing, Daniel Henrique Barboza, 2022/04/20
- [PULL 20/23] pcie: Don't try triggering a LSI when not defined, Daniel Henrique Barboza, 2022/04/20
- [PULL 21/23] ppc/pnv: Remove LSI on the PCIE host bridge, Daniel Henrique Barboza, 2022/04/20
- [PULL 22/23] target/ppc: Add two missing register callbacks on POWER10, Daniel Henrique Barboza, 2022/04/20
- [PULL 23/23] hw/ppc: change indentation to spaces from TABs, Daniel Henrique Barboza, 2022/04/20
- Re: [PULL 00/23] ppc queue, Richard Henderson, 2022/04/21