From 5e6da2bc6e03f0e3133f78abb9c34b730c765aa4 Mon Sep 17 00:00:00 2001 From: MetalliC <0vetal0@gmail.com> Date: Sat, 4 May 2019 15:42:36 +0300 Subject: sharc: add compute_fcopysign --- src/devices/cpu/sharc/compute.hxx | 18 ++++++++++++++++++ src/devices/cpu/sharc/sharc.h | 1 + src/devices/cpu/sharc/sharcops.hxx | 1 + 3 files changed, 20 insertions(+) diff --git a/src/devices/cpu/sharc/compute.hxx b/src/devices/cpu/sharc/compute.hxx index 196c9fdf532..766d7be044f 100644 --- a/src/devices/cpu/sharc/compute.hxx +++ b/src/devices/cpu/sharc/compute.hxx @@ -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) { diff --git a/src/devices/cpu/sharc/sharc.h b/src/devices/cpu/sharc/sharc.h index 731a0ac1464..93495d5c744 100644 --- a/src/devices/cpu/sharc/sharc.h +++ b/src/devices/cpu/sharc/sharc.h @@ -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); diff --git a/src/devices/cpu/sharc/sharcops.hxx b/src/devices/cpu/sharc/sharcops.hxx index aa01c5bfab2..ae2248b309f 100644 --- a/src/devices/cpu/sharc/sharcops.hxx +++ b/src/devices/cpu/sharc/sharcops.hxx @@ -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; -- cgit v1.2.3