[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 17/29] target-ppc: add vclzlsbb/vctzlsbb instructions
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 17/29] target-ppc: add vclzlsbb/vctzlsbb instructions |
Date: |
Thu, 6 Oct 2016 23:03:03 +1100 |
From: Rajalakshmi Srinivasaraghavan <address@hidden>
The following vector instructions are added from ISA 3.0.
vclzlsbb - Vector Count Leading Zero Least-Significant Bits Byte
vctzlsbb - Vector Count Trailing Zero Least-Significant Bits Byte
Signed-off-by: Rajalakshmi Srinivasaraghavan <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
target-ppc/helper.h | 2 ++
target-ppc/int_helper.c | 30 ++++++++++++++++++++++++++++++
target-ppc/translate/vmx-impl.inc.c | 14 ++++++++++++++
target-ppc/translate/vmx-ops.inc.c | 2 ++
4 files changed, 48 insertions(+)
diff --git a/target-ppc/helper.h b/target-ppc/helper.h
index 91c2082..796ad45 100644
--- a/target-ppc/helper.h
+++ b/target-ppc/helper.h
@@ -343,6 +343,8 @@ DEF_HELPER_2(vpopcntb, void, avr, avr)
DEF_HELPER_2(vpopcnth, void, avr, avr)
DEF_HELPER_2(vpopcntw, void, avr, avr)
DEF_HELPER_2(vpopcntd, void, avr, avr)
+DEF_HELPER_1(vclzlsbb, tl, avr)
+DEF_HELPER_1(vctzlsbb, tl, avr)
DEF_HELPER_3(vbpermd, void, avr, avr, avr)
DEF_HELPER_3(vbpermq, void, avr, avr, avr)
DEF_HELPER_2(vgbbd, void, avr, avr)
diff --git a/target-ppc/int_helper.c b/target-ppc/int_helper.c
index 77d6bce..202854f 100644
--- a/target-ppc/int_helper.c
+++ b/target-ppc/int_helper.c
@@ -881,6 +881,36 @@ VCT(uxs, cvtsduw, u32)
VCT(sxs, cvtsdsw, s32)
#undef VCT
+target_ulong helper_vclzlsbb(ppc_avr_t *r)
+{
+ target_ulong count = 0;
+ int i;
+ VECTOR_FOR_INORDER_I(i, u8) {
+ if (r->u8[i] & 0x01) {
+ break;
+ }
+ count++;
+ }
+ return count;
+}
+
+target_ulong helper_vctzlsbb(ppc_avr_t *r)
+{
+ target_ulong count = 0;
+ int i;
+#if defined(HOST_WORDS_BIGENDIAN)
+ for (i = ARRAY_SIZE(r->u8) - 1; i >= 0; i--) {
+#else
+ for (i = 0; i < ARRAY_SIZE(r->u8); i++) {
+#endif
+ if (r->u8[i] & 0x01) {
+ break;
+ }
+ count++;
+ }
+ return count;
+}
+
void helper_vmhaddshs(CPUPPCState *env, ppc_avr_t *r, ppc_avr_t *a,
ppc_avr_t *b, ppc_avr_t *c)
{
diff --git a/target-ppc/translate/vmx-impl.inc.c
b/target-ppc/translate/vmx-impl.inc.c
index fd06abc..f646e85 100644
--- a/target-ppc/translate/vmx-impl.inc.c
+++ b/target-ppc/translate/vmx-impl.inc.c
@@ -593,6 +593,18 @@ static void glue(gen_, name)(DisasContext *ctx)
\
tcg_temp_free_ptr(rd); \
}
+#define GEN_VXFORM_NOA_3(name, opc2, opc3, opc4) \
+static void glue(gen_, name)(DisasContext *ctx) \
+ { \
+ TCGv_ptr rb; \
+ if (unlikely(!ctx->altivec_enabled)) { \
+ gen_exception(ctx, POWERPC_EXCP_VPU); \
+ return; \
+ } \
+ rb = gen_avr_ptr(rB(ctx->opcode)); \
+ gen_helper_##name(cpu_gpr[rD(ctx->opcode)], rb); \
+ tcg_temp_free_ptr(rb); \
+ }
GEN_VXFORM_NOA(vupkhsb, 7, 8);
GEN_VXFORM_NOA(vupkhsh, 7, 9);
GEN_VXFORM_NOA(vupkhsw, 7, 25);
@@ -807,6 +819,8 @@ GEN_VXFORM_NOA_2(vctzb, 1, 24, 28)
GEN_VXFORM_NOA_2(vctzh, 1, 24, 29)
GEN_VXFORM_NOA_2(vctzw, 1, 24, 30)
GEN_VXFORM_NOA_2(vctzd, 1, 24, 31)
+GEN_VXFORM_NOA_3(vclzlsbb, 1, 24, 0)
+GEN_VXFORM_NOA_3(vctzlsbb, 1, 24, 1)
GEN_VXFORM_NOA(vpopcntb, 1, 28)
GEN_VXFORM_NOA(vpopcnth, 1, 29)
GEN_VXFORM_NOA(vpopcntw, 1, 30)
diff --git a/target-ppc/translate/vmx-ops.inc.c
b/target-ppc/translate/vmx-ops.inc.c
index 1edb353..b63e33d 100644
--- a/target-ppc/translate/vmx-ops.inc.c
+++ b/target-ppc/translate/vmx-ops.inc.c
@@ -219,6 +219,8 @@ GEN_VXFORM_300_EO(vctzb, 0x01, 0x18, 0x1C),
GEN_VXFORM_300_EO(vctzh, 0x01, 0x18, 0x1D),
GEN_VXFORM_300_EO(vctzw, 0x01, 0x18, 0x1E),
GEN_VXFORM_300_EO(vctzd, 0x01, 0x18, 0x1F),
+GEN_VXFORM_300_EO(vclzlsbb, 0x01, 0x18, 0x0),
+GEN_VXFORM_300_EO(vctzlsbb, 0x01, 0x18, 0x1),
GEN_VXFORM_300(vpermr, 0x1D, 0xFF),
#define GEN_VXFORM_NOA(name, opc2, opc3) \
--
2.7.4
- [Qemu-ppc] [PULL 25/29] libqos: use generic qtest_shutdown(), (continued)
- [Qemu-ppc] [PULL 25/29] libqos: use generic qtest_shutdown(), David Gibson, 2016/10/06
- [Qemu-ppc] [PULL 18/29] target-ppc: Implement mtvsrws instruction, David Gibson, 2016/10/06
- [Qemu-ppc] [PULL 28/29] tests/pxe: Use -nodefaults to speed up ppc64/ipv6 pxe test, David Gibson, 2016/10/06
- [Qemu-ppc] [PULL 22/29] target-ppc: fix vmx instruction type/type2, David Gibson, 2016/10/06
- [Qemu-ppc] [PULL 06/29] ppc: Check the availability of transactional memory, David Gibson, 2016/10/06
- [Qemu-ppc] [PULL 27/29] spapr: fix check of cpu alias name in spapr_get_cpu_core_type(), David Gibson, 2016/10/06
- [Qemu-ppc] [PULL 29/29] hw/ppc/spapr: Use POWER8 by default for the pseries-2.8 machine, David Gibson, 2016/10/06
- [Qemu-ppc] [PULL 12/29] target-ppc: add stxvh8x instruction, David Gibson, 2016/10/06
- [Qemu-ppc] [PULL 23/29] libqos: add PPC64 PCI support, David Gibson, 2016/10/06
- [Qemu-ppc] [PULL 09/29] target-ppc: improve lxvw4x implementation, David Gibson, 2016/10/06
- [Qemu-ppc] [PULL 17/29] target-ppc: add vclzlsbb/vctzlsbb instructions,
David Gibson <=
- [Qemu-ppc] [PULL 26/29] tests: enable ohci/uhci/xhci tests on PPC64, David Gibson, 2016/10/06
- [Qemu-ppc] [PULL 24/29] libqos: add PCI management in qtest_vboot()/qtest_shutdown(), David Gibson, 2016/10/06
- Re: [Qemu-ppc] [PULL 00/29] ppc-for-2.8 queue 20161006, Peter Maydell, 2016/10/06