[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 047/107] target-ppc: Add xxinsertw instruction
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 047/107] target-ppc: Add xxinsertw instruction |
Date: |
Thu, 2 Feb 2017 16:13:45 +1100 |
From: Nikunj A Dadhania <address@hidden>
xxinsertw: VSX Vector Insert Word
Signed-off-by: Nikunj A Dadhania <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
target/ppc/helper.h | 1 +
target/ppc/int_helper.c | 25 +++++++++++++++++++++++++
target/ppc/translate/vsx-impl.inc.c | 5 +++--
target/ppc/translate/vsx-ops.inc.c | 1 +
4 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/target/ppc/helper.h b/target/ppc/helper.h
index ead799c..a4504eb 100644
--- a/target/ppc/helper.h
+++ b/target/ppc/helper.h
@@ -536,6 +536,7 @@ DEF_HELPER_2(xvrspiz, void, env, i32)
DEF_HELPER_2(xxperm, void, env, i32)
DEF_HELPER_2(xxpermr, void, env, i32)
DEF_HELPER_4(xxextractuw, void, env, tl, tl, i32)
+DEF_HELPER_4(xxinsertw, void, env, tl, tl, i32)
DEF_HELPER_2(efscfsi, i32, env, i32)
DEF_HELPER_2(efscfui, i32, env, i32)
diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c
index 07832ba..81f134b 100644
--- a/target/ppc/int_helper.c
+++ b/target/ppc/int_helper.c
@@ -2027,6 +2027,31 @@ void helper_xxextractuw(CPUPPCState *env, target_ulong
xtn,
putVSR(xtn, &xt, env);
}
+void helper_xxinsertw(CPUPPCState *env, target_ulong xtn,
+ target_ulong xbn, uint32_t index)
+{
+ ppc_vsr_t xt, xb;
+ size_t es = sizeof(uint32_t);
+ int ins_index, i = 0;
+
+ getVSR(xbn, &xb, env);
+ getVSR(xtn, &xt, env);
+
+#if defined(HOST_WORDS_BIGENDIAN)
+ ins_index = index;
+ for (i = 0; i < es && ins_index < 16; i++, ins_index++) {
+ xt.u8[ins_index] = xb.u8[8 - es + i];
+ }
+#else
+ ins_index = 15 - index;
+ for (i = es - 1; i >= 0 && ins_index >= 0; i--, ins_index--) {
+ xt.u8[ins_index] = xb.u8[8 + i];
+ }
+#endif
+
+ putVSR(xtn, &xt, env);
+}
+
#define VEXT_SIGNED(name, element, mask, cast, recast) \
void helper_##name(ppc_avr_t *r, ppc_avr_t *b) \
{ \
diff --git a/target/ppc/translate/vsx-impl.inc.c
b/target/ppc/translate/vsx-impl.inc.c
index 7977f24..c9ba0f5 100644
--- a/target/ppc/translate/vsx-impl.inc.c
+++ b/target/ppc/translate/vsx-impl.inc.c
@@ -1180,7 +1180,7 @@ static void gen_xxsldwi(DisasContext *ctx)
tcg_temp_free_i64(xtl);
}
-#define VSX_EXTRACT(name) \
+#define VSX_EXTRACT_INSERT(name) \
static void gen_##name(DisasContext *ctx) \
{ \
TCGv xt, xb; \
@@ -1208,7 +1208,8 @@ static void gen_##name(DisasContext *ctx)
\
tcg_temp_free_i32(t0); \
}
-VSX_EXTRACT(xxextractuw)
+VSX_EXTRACT_INSERT(xxextractuw)
+VSX_EXTRACT_INSERT(xxinsertw)
#undef GEN_XX2FORM
#undef GEN_XX3FORM
diff --git a/target/ppc/translate/vsx-ops.inc.c
b/target/ppc/translate/vsx-ops.inc.c
index 473d925..096d358 100644
--- a/target/ppc/translate/vsx-ops.inc.c
+++ b/target/ppc/translate/vsx-ops.inc.c
@@ -285,6 +285,7 @@ GEN_XX2FORM(xxspltw, 0x08, 0x0A, PPC2_VSX),
GEN_XX1FORM(xxspltib, 0x08, 0x0B, PPC2_ISA300),
GEN_XX3FORM_DM(xxsldwi, 0x08, 0x00),
GEN_XX2FORM_EXT(xxextractuw, 0x0A, 0x0A, PPC2_ISA300),
+GEN_XX2FORM_EXT(xxinsertw, 0x0A, 0x0B, PPC2_ISA300),
#define GEN_XXSEL_ROW(opc3) \
GEN_HANDLER2_E(xxsel, "xxsel", 0x3C, 0x18, opc3, 0, PPC_NONE, PPC2_VSX), \
--
2.9.3
- [Qemu-ppc] [PULL 037/107] qtest: add netfilter tests for ppc64, (continued)
- [Qemu-ppc] [PULL 037/107] qtest: add netfilter tests for ppc64, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 023/107] target-ppc: Implement bcd_is_valid function, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 045/107] hw/ppc: QOM'ify spapr_vio.c, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 038/107] qtest: add display-vga-test to ppc64, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 032/107] prep: do not use global variable to access nvram, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 031/107] hw/ppc/spapr: Fix boot path of usb-host storage devices, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 039/107] libqos: fix spapr qpci_map(), David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 044/107] hw/ppc: QOM'ify ppce500_spin.c, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 034/107] ppc: Rewrite ppc_set_compat(), David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 051/107] target-ppc: Use float64 arg in helper_compute_fprf(), David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 047/107] target-ppc: Add xxinsertw instruction,
David Gibson <=
- [Qemu-ppc] [PULL 026/107] target-ppc: Add xxperm and xxpermr instructions, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 059/107] target-ppc: Add xsxsigqp instructions, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 028/107] target-ppc: implement lxvll instruction, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 042/107] hw/gpio: QOM'ify mpc8xxx.c, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 066/107] ppc: Prevent inifnite loop in decrementer auto-reload., David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 069/107] softfloat: Fix the default qNAN for target-ppc, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 049/107] prep: add IBM RS/6000 7020 (40p) memory controller, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 067/107] ppc: Fix a warning in bcdcfz code and improve BCD_DIG_BYTE macro, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 029/107] target-ppc: implement stxvl instruction, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 043/107] hw/ppc: QOM'ify e500.c, David Gibson, 2017/02/02