sharc: add compute_fcopysign

This commit is contained in:
MetalliC 2019-05-04 15:42:36 +03:00
parent 8e05fbf3b8
commit 5e6da2bc6e
3 changed files with 20 additions and 0 deletions

View File

@ -736,6 +736,24 @@ void adsp21062_device::compute_fmin(int rn, int rx, int ry)
m_core->astat |= AF;
}
/* Fn = COPYSIGN(Fx, Fy) */
void adsp21062_device::compute_fcopysign(int rn, int rx, int ry)
{
SHARC_REG r_alu;
r_alu.r = (REG(rx) & 0x7fffffff) | (REG(ry) & 0x80000000); // TODO DENORM and NAN cases ?
CLEAR_ALU_FLAGS();
m_core->astat |= (r_alu.f < 0.0f) ? AN : 0;
// AZ
m_core->astat |= (IS_FLOAT_ZERO(r_alu.r)) ? AZ : 0;
// AI
m_core->astat |= (IS_FLOAT_NAN(REG(rx)) || IS_FLOAT_NAN(REG(ry))) ? AI : 0;
FREG(rn) = r_alu.f;
m_core->astat |= AF;
}
/* Fn = CLIP Fx BY Fy */
void adsp21062_device::compute_fclip(int rn, int rx, int ry)
{

View File

@ -566,6 +566,7 @@ private:
inline void compute_fabs_plus(int rn, int rx, int ry);
inline void compute_fmax(int rn, int rx, int ry);
inline void compute_fmin(int rn, int rx, int ry);
inline void compute_fcopysign(int rn, int rx, int ry);
inline void compute_fclip(int rn, int rx, int ry);
inline void compute_recips(int rn, int rx);
inline void compute_rsqrts(int rn, int rx);

View File

@ -822,6 +822,7 @@ void adsp21062_device::COMPUTE(uint32_t opcode)
case 0xca: compute_float(rn, rx); break;
case 0xd9: compute_fix_scaled(rn, rx, ry); break;
case 0xda: compute_float_scaled(rn, rx, ry); break;
case 0xe0: compute_fcopysign(rn, rx, ry); break;
case 0xe1: compute_fmin(rn, rx, ry); break;
case 0xe2: compute_fmax(rn, rx, ry); break;
case 0xe3: compute_fclip(rn, rx, ry); break;