[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 28/37] target/ppc: rework vmul{e, o}{s, u}{b, h, w} ins
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 28/37] target/ppc: rework vmul{e, o}{s, u}{b, h, w} instructions to use Vsr* macros |
Date: |
Mon, 4 Feb 2019 20:01:15 +1100 |
From: Mark Cave-Ayland <address@hidden>
The current implementations make use of the endian-specific macros HI_IDX and
LO_IDX directly to calculate array offsets.
Rework the implementation to use the Vsr* macros so that these per-endian
references can be removed.
Signed-off-by: Mark Cave-Ayland <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
target/ppc/int_helper.c | 48 +++++++++++++++++++++++------------------
1 file changed, 27 insertions(+), 21 deletions(-)
diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c
index fe418b3393..e531af5294 100644
--- a/target/ppc/int_helper.c
+++ b/target/ppc/int_helper.c
@@ -1104,33 +1104,39 @@ void helper_vmsumuhs(CPUPPCState *env, ppc_avr_t *r,
ppc_avr_t *a,
}
}
-#define VMUL_DO(name, mul_element, prod_element, cast, evenp) \
+#define VMUL_DO_EVN(name, mul_element, mul_access, prod_access, cast) \
void helper_v##name(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) \
{ \
int i; \
\
- VECTOR_FOR_INORDER_I(i, prod_element) { \
- if (evenp) { \
- r->prod_element[i] = \
- (cast)a->mul_element[i * 2 + HI_IDX] * \
- (cast)b->mul_element[i * 2 + HI_IDX]; \
- } else { \
- r->prod_element[i] = \
- (cast)a->mul_element[i * 2 + LO_IDX] * \
- (cast)b->mul_element[i * 2 + LO_IDX]; \
- } \
+ for (i = 0; i < ARRAY_SIZE(r->mul_element); i += 2) { \
+ r->prod_access(i >> 1) = (cast)a->mul_access(i) * \
+ (cast)b->mul_access(i); \
+ } \
+ }
+
+#define VMUL_DO_ODD(name, mul_element, mul_access, prod_access, cast) \
+ void helper_v##name(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) \
+ { \
+ int i; \
+ \
+ for (i = 0; i < ARRAY_SIZE(r->mul_element); i += 2) { \
+ r->prod_access(i >> 1) = (cast)a->mul_access(i + 1) * \
+ (cast)b->mul_access(i + 1); \
} \
}
-#define VMUL(suffix, mul_element, prod_element, cast) \
- VMUL_DO(mule##suffix, mul_element, prod_element, cast, 1) \
- VMUL_DO(mulo##suffix, mul_element, prod_element, cast, 0)
-VMUL(sb, s8, s16, int16_t)
-VMUL(sh, s16, s32, int32_t)
-VMUL(sw, s32, s64, int64_t)
-VMUL(ub, u8, u16, uint16_t)
-VMUL(uh, u16, u32, uint32_t)
-VMUL(uw, u32, u64, uint64_t)
-#undef VMUL_DO
+
+#define VMUL(suffix, mul_element, mul_access, prod_access, cast) \
+ VMUL_DO_EVN(mule##suffix, mul_element, mul_access, prod_access, cast) \
+ VMUL_DO_ODD(mulo##suffix, mul_element, mul_access, prod_access, cast)
+VMUL(sb, s8, VsrSB, VsrSH, int16_t)
+VMUL(sh, s16, VsrSH, VsrSW, int32_t)
+VMUL(sw, s32, VsrSW, VsrSD, int64_t)
+VMUL(ub, u8, VsrB, VsrH, uint16_t)
+VMUL(uh, u16, VsrH, VsrW, uint32_t)
+VMUL(uw, u32, VsrW, VsrD, uint64_t)
+#undef VMUL_DO_EVN
+#undef VMUL_DO_ODD
#undef VMUL
void helper_vperm(CPUPPCState *env, ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b,
--
2.20.1
- [Qemu-ppc] [PULL 12/37] hw/ppc/spapr: Encode the SCSI channel (bus) in the SRP LUNs, (continued)
- [Qemu-ppc] [PULL 12/37] hw/ppc/spapr: Encode the SCSI channel (bus) in the SRP LUNs, David Gibson, 2019/02/04
- [Qemu-ppc] [PULL 27/37] target/ppc: rework vmrg{l, h}{b, h, w} instructions to use Vsr* macros, David Gibson, 2019/02/04
- [Qemu-ppc] [PULL 08/37] ppc/xive: fix remaining XiveFabric names, David Gibson, 2019/02/04
- [Qemu-ppc] [PULL 17/37] spapr: move the interrupt presenters under machine_data, David Gibson, 2019/02/04
- [Qemu-ppc] [PULL 24/37] MAINTAINERS: add myself as maintainer for Mac Old World and New World machines, David Gibson, 2019/02/04
- [Qemu-ppc] [PULL 19/37] ppc: remove the interrupt presenters from under PowerPCCPU, David Gibson, 2019/02/04
- [Qemu-ppc] [PULL 22/37] MAINTAINERS: Merge the two e500 sections, David Gibson, 2019/02/04
- [Qemu-ppc] [PULL 15/37] xive: add a get_tctx() method to the XiveRouter, David Gibson, 2019/02/04
- [Qemu-ppc] [PULL 18/37] target/ppc: implement complete set of Vsr* macros, David Gibson, 2019/02/04
- [Qemu-ppc] [PULL 06/37] ppc4xx: Pass array index to function instead of pointer into the array, David Gibson, 2019/02/04
- [Qemu-ppc] [PULL 28/37] target/ppc: rework vmul{e, o}{s, u}{b, h, w} instructions to use Vsr* macros,
David Gibson <=
- [Qemu-ppc] [PULL 23/37] spapr: Drop unused parameters from fdt building helper, David Gibson, 2019/02/04
- [Qemu-ppc] [PULL 25/37] QemuMacDrivers: update qemu_vga.ndrv to 90c488d built from submodule, David Gibson, 2019/02/04
- [Qemu-ppc] [PULL 20/37] hw/ppc: Move ppc40x_*reset() functions from ppc405_uc.c to ppc.c, David Gibson, 2019/02/04
- [Qemu-ppc] [PULL 21/37] MAINTAINERS: XIVE is an interrupt controller, not a machine, David Gibson, 2019/02/04
- [Qemu-ppc] [PULL 37/37] mmap-alloc: fix hugetlbfs misaligned length in ppc64, David Gibson, 2019/02/04
- [Qemu-ppc] [PULL 32/37] target/ppc: remove ROTRu32 and ROTRu64 macros from int_helper.c, David Gibson, 2019/02/04
- [Qemu-ppc] [PULL 26/37] hw/ppc/spapr: Add support for "-vga cirrus", David Gibson, 2019/02/04
- [Qemu-ppc] [PULL 16/37] ppc/pnv: introduce a CPU machine_data, David Gibson, 2019/02/04
- [Qemu-ppc] [PULL 34/37] spapr_pci: Fix endianness in assigned-addresses property, David Gibson, 2019/02/04
- [Qemu-ppc] [PULL 31/37] target/ppc: simplify VEXT_SIGNED macro in int_helper.c, David Gibson, 2019/02/04