target-ppc: Add xsmaxjdp and xsminjdp instructions

xsmaxjdp: VSX Scalar Maximum Type-J Double-Precision
xsminjdp: VSX Scalar Minimum Type-J Double-Precision

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 2017-02-06 16:00:00 +05:30 committed by David Gibson
parent 2770deede0
commit d4ccd87e68
4 changed files with 61 additions and 0 deletions

View file

@ -2717,6 +2717,61 @@ void helper_##name(CPUPPCState *env, uint32_t opcode) \
VSX_MAX_MINC(xsmaxcdp, 1);
VSX_MAX_MINC(xsmincdp, 0);
#define VSX_MAX_MINJ(name, max) \
void helper_##name(CPUPPCState *env, uint32_t opcode) \
{ \
ppc_vsr_t xt, xa, xb; \
bool vxsnan_flag = false, vex_flag = false; \
\
getVSR(rA(opcode) + 32, &xa, env); \
getVSR(rB(opcode) + 32, &xb, env); \
getVSR(rD(opcode) + 32, &xt, env); \
\
if (unlikely(float64_is_any_nan(xa.VsrD(0)))) { \
if (float64_is_signaling_nan(xa.VsrD(0), &env->fp_status)) { \
vxsnan_flag = true; \
} \
xt.VsrD(0) = xa.VsrD(0); \
} else if (unlikely(float64_is_any_nan(xb.VsrD(0)))) { \
if (float64_is_signaling_nan(xb.VsrD(0), &env->fp_status)) { \
vxsnan_flag = true; \
} \
xt.VsrD(0) = xb.VsrD(0); \
} else if (float64_is_zero(xa.VsrD(0)) && float64_is_zero(xb.VsrD(0))) { \
if (max) { \
if (!float64_is_neg(xa.VsrD(0)) || !float64_is_neg(xb.VsrD(0))) { \
xt.VsrD(0) = 0ULL; \
} else { \
xt.VsrD(0) = 0x8000000000000000ULL; \
} \
} else { \
if (float64_is_neg(xa.VsrD(0)) || float64_is_neg(xb.VsrD(0))) { \
xt.VsrD(0) = 0x8000000000000000ULL; \
} else { \
xt.VsrD(0) = 0ULL; \
} \
} \
} else if ((max && \
!float64_lt(xa.VsrD(0), xb.VsrD(0), &env->fp_status)) || \
(!max && \
float64_lt(xa.VsrD(0), xb.VsrD(0), &env->fp_status))) { \
xt.VsrD(0) = xa.VsrD(0); \
} else { \
xt.VsrD(0) = xb.VsrD(0); \
} \
\
vex_flag = fpscr_ve & vxsnan_flag; \
if (vxsnan_flag) { \
float_invalid_op_excp(env, POWERPC_EXCP_FP_VXSNAN, 0); \
} \
if (!vex_flag) { \
putVSR(rD(opcode) + 32, &xt, env); \
} \
} \
VSX_MAX_MINJ(xsmaxjdp, 1);
VSX_MAX_MINJ(xsminjdp, 0);
/* VSX_CMP - VSX floating point compare
* op - instruction mnemonic
* nels - number of elements (1, 2 or 4)