target-ppc: Add xxperm and xxpermr instructions

xxperm:  VSX Vector Permute
xxpermr: VSX Vector Permute Right-indexed

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
Bharata B Rao 2016-12-07 23:55:02 +05:30 committed by David Gibson
parent 014ed3bb20
commit 234068abfb
4 changed files with 29 additions and 0 deletions

View file

@ -2869,3 +2869,26 @@ uint64_t helper_xsrsp(CPUPPCState *env, uint64_t xb)
float_check_status(env);
return xt;
}
#define VSX_XXPERM(op, indexed) \
void helper_##op(CPUPPCState *env, uint32_t opcode) \
{ \
ppc_vsr_t xt, xa, pcv, xto; \
int i, idx; \
\
getVSR(xA(opcode), &xa, env); \
getVSR(xT(opcode), &xt, env); \
getVSR(xB(opcode), &pcv, env); \
\
for (i = 0; i < 16; i++) { \
idx = pcv.VsrB(i) & 0x1F; \
if (indexed) { \
idx = 31 - idx; \
} \
xto.VsrB(i) = (idx <= 15) ? xa.VsrB(idx) : xt.VsrB(idx - 16); \
} \
putVSR(xT(opcode), &xto, env); \
}
VSX_XXPERM(xxperm, 0)
VSX_XXPERM(xxpermr, 1)