[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 13/28] target-ppc: Altivec 2.07: Vector Population C
From: |
Tom Musta |
Subject: |
[Qemu-devel] [PATCH 13/28] target-ppc: Altivec 2.07: Vector Population Count Instructions |
Date: |
Wed, 12 Feb 2014 15:23:04 -0600 |
This patch adds the Vector Population Count instructions introduced in Power
ISA Version 2.07: vpopcntb, vpopcnth, vpopcntw and vpopcntd.
Signed-off-by: Tom Musta <address@hidden>
---
target-ppc/helper.h | 4 ++++
target-ppc/int_helper.c | 14 ++++++++++++++
target-ppc/translate.c | 22 ++++++++++++++++++----
3 files changed, 36 insertions(+), 4 deletions(-)
diff --git a/target-ppc/helper.h b/target-ppc/helper.h
index 7ca219f..793877d 100644
--- a/target-ppc/helper.h
+++ b/target-ppc/helper.h
@@ -277,6 +277,10 @@ DEF_HELPER_2(vclzb, void, avr, avr)
DEF_HELPER_2(vclzh, void, avr, avr)
DEF_HELPER_2(vclzw, void, avr, avr)
DEF_HELPER_2(vclzd, void, avr, avr)
+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_2(xsadddp, void, env, i32)
DEF_HELPER_2(xssubdp, void, env, i32)
diff --git a/target-ppc/int_helper.c b/target-ppc/int_helper.c
index 7fca9f0..3b67ae3 100644
--- a/target-ppc/int_helper.c
+++ b/target-ppc/int_helper.c
@@ -1549,6 +1549,20 @@ VGENERIC_DO(clzd, u64)
#undef clzw
#undef clzd
+#define popcntb(v) ctpop8(v)
+#define popcnth(v) ctpop16(v)
+#define popcntw(v) ctpop32(v)
+#define popcntd(v) ctpop64(v)
+
+VGENERIC_DO(popcntb, u8)
+VGENERIC_DO(popcnth, u16)
+VGENERIC_DO(popcntw, u32)
+VGENERIC_DO(popcntd, u64)
+
+#undef popcntb
+#undef popcnth
+#undef popcntw
+#undef popcntd
#undef VGENERIC_DO
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index ff6ddfc..e2036bb 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -7285,6 +7285,19 @@ GEN_VXFORM_NOA(vclzb, 1, 28)
GEN_VXFORM_NOA(vclzh, 1, 29)
GEN_VXFORM_NOA(vclzw, 1, 30)
GEN_VXFORM_NOA(vclzd, 1, 31)
+GEN_VXFORM_NOA(vpopcntb, 1, 28)
+GEN_VXFORM_NOA(vpopcnth, 1, 29)
+GEN_VXFORM_NOA(vpopcntw, 1, 30)
+GEN_VXFORM_NOA(vpopcntd, 1, 31)
+GEN_VXFORM_DUAL(vclzb, PPC_NONE, PPC2_ALTIVEC_207, \
+ vpopcntb, PPC_NONE, PPC2_ALTIVEC_207)
+GEN_VXFORM_DUAL(vclzh, PPC_NONE, PPC2_ALTIVEC_207, \
+ vpopcnth, PPC_NONE, PPC2_ALTIVEC_207)
+GEN_VXFORM_DUAL(vclzw, PPC_NONE, PPC2_ALTIVEC_207, \
+ vpopcntw, PPC_NONE, PPC2_ALTIVEC_207)
+GEN_VXFORM_DUAL(vclzd, PPC_NONE, PPC2_ALTIVEC_207, \
+ vpopcntd, PPC_NONE, PPC2_ALTIVEC_207)
+
/*** VSX extension ***/
static inline TCGv_i64 cpu_vsrh(int n)
@@ -10481,10 +10494,11 @@ GEN_VAFORM_PAIRED(vmsumshm, vmsumshs, 20),
GEN_VAFORM_PAIRED(vsel, vperm, 21),
GEN_VAFORM_PAIRED(vmaddfp, vnmsubfp, 23),
-GEN_VXFORM_207(vclzb, 1, 28),
-GEN_VXFORM_207(vclzh, 1, 29),
-GEN_VXFORM_207(vclzw, 1, 30),
-GEN_VXFORM_207(vclzd, 1, 31),
+GEN_VXFORM_DUAL(vclzb, vpopcntb, 1, 28, PPC_NONE, PPC2_ALTIVEC_207),
+GEN_VXFORM_DUAL(vclzh, vpopcnth, 1, 29, PPC_NONE, PPC2_ALTIVEC_207),
+GEN_VXFORM_DUAL(vclzw, vpopcntw, 1, 30, PPC_NONE, PPC2_ALTIVEC_207),
+GEN_VXFORM_DUAL(vclzd, vpopcntd, 1, 31, PPC_NONE, PPC2_ALTIVEC_207),
+
GEN_HANDLER_E(lxsdx, 0x1F, 0x0C, 0x12, 0, PPC_NONE, PPC2_VSX),
GEN_HANDLER_E(lxsiwax, 0x1F, 0x0C, 0x02, 0, PPC_NONE, PPC2_VSX207),
--
1.7.1
- [Qemu-devel] [PATCH 03/28] target-ppc: Altivec 2.07: Add GEN_VXFORM3, (continued)
- [Qemu-devel] [PATCH 03/28] target-ppc: Altivec 2.07: Add GEN_VXFORM3, Tom Musta, 2014/02/12
- [Qemu-devel] [PATCH 04/28] target-ppc: Altivec 2.07: Add Support for Dual Altivec Instructions, Tom Musta, 2014/02/12
- [Qemu-devel] [PATCH 05/28] target-ppc: Altivec 2.07: Add Opcode Macro for VX Form Instructions, Tom Musta, 2014/02/12
- [Qemu-devel] [PATCH 06/28] target-ppc: Altivec 2.07: Add Support for R-Form Dual Instructions, Tom Musta, 2014/02/12
- [Qemu-devel] [PATCH 07/28] target-ppc: Altivec 2.07: Vector Logical Instructions, Tom Musta, 2014/02/12
- [Qemu-devel] [PATCH 08/28] target-ppc: Altivec 2.07: Add/Subtract Unsigned Doubleword Modulo, Tom Musta, 2014/02/12
- [Qemu-devel] [PATCH 09/28] target-ppc: Altivec 2.07: Change VMUL_DO to Support 64-bit Integers, Tom Musta, 2014/02/12
- [Qemu-devel] [PATCH 10/28] target-ppc: Altivec 2.07: Multiply Even/Odd Word Instructions, Tom Musta, 2014/02/12
- [Qemu-devel] [PATCH 11/28] target-ppc: Altivec 2.07: vmuluw Instruction, Tom Musta, 2014/02/12
- [Qemu-devel] [PATCH 12/28] target-ppc: Altivec 2.07: Add Vector Count Leading Zeroes, Tom Musta, 2014/02/12
- [Qemu-devel] [PATCH 13/28] target-ppc: Altivec 2.07: Vector Population Count Instructions,
Tom Musta <=
- [Qemu-devel] [PATCH 14/28] target-ppc: Altivec 2.07: Vector Min/Max Doubleword Instructions, Tom Musta, 2014/02/12
- [Qemu-devel] [PATCH 15/28] target-ppc: Altivec 2.07: Pack Doubleword Instructions, Tom Musta, 2014/02/12
- [Qemu-devel] [PATCH 16/28] target-ppc: Altivec 2.07: Unpack Signed Word Instructions, Tom Musta, 2014/02/12
- [Qemu-devel] [PATCH 17/28] target-ppc: Altivec 2.07: Vector Merge Instructions, Tom Musta, 2014/02/12
- [Qemu-devel] [PATCH 18/28] target-ppc: Altivec 2.07: Change Bit Masks to Support 64-bit Rotates and Shifts, Tom Musta, 2014/02/12
- [Qemu-devel] [PATCH 19/28] target-ppc: Altivec 2.07: Vector Doubleword Rotate and Shift Instructions, Tom Musta, 2014/02/12
- [Qemu-devel] [PATCH 20/28] target-ppc: Altivec 2.07: Quadword Addition and Subtracation, Tom Musta, 2014/02/12
- [Qemu-devel] [PATCH 21/28] target-ppc: Altivec 2.07: vbpermq Instruction, Tom Musta, 2014/02/12
- [Qemu-devel] [PATCH 22/28] target-ppc: Altivec 2.07: Doubleword Compares, Tom Musta, 2014/02/12
- [Qemu-devel] [PATCH 23/28] target-ppc: Altivec 2.07: Vector Gather Bits by Bytes, Tom Musta, 2014/02/12