mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2024-12-23 20:05:30 +00:00
b08d204a37
The m68k-specific softfloat code includes a function floatx80_mod that is extremely similar to floatx80_rem, but computing the remainder based on truncating the quotient toward zero rather than rounding it to nearest integer. This is also useful for emulating the x87 fprem and fprem1 instructions. Change the floatx80_rem implementation into floatx80_modrem that can perform either operation, with both floatx80_rem and floatx80_mod as thin wrappers available for all targets. There does not appear to be any use for the _mod operation for other floating-point formats in QEMU (the only other architectures using _rem at all are linux-user/arm/nwfpe, for FPA emulation, and openrisc, for instructions that have been removed in the latest version of the architecture), so no change is made to the code for other formats. Backports commit 6b8b0136ab3018e4b552b485f808bf66bcf19ead from qemu
49 lines
2.2 KiB
C
49 lines
2.2 KiB
C
/*
|
|
* Ported from a work by Andreas Grabher for Previous, NeXT Computer Emulator,
|
|
* derived from NetBSD M68040 FPSP functions,
|
|
* derived from release 2a of the SoftFloat IEC/IEEE Floating-point Arithmetic
|
|
* Package. Those parts of the code (and some later contributions) are
|
|
* provided under that license, as detailed below.
|
|
* It has subsequently been modified by contributors to the QEMU Project,
|
|
* so some portions are provided under:
|
|
* the SoftFloat-2a license
|
|
* the BSD license
|
|
* GPL-v2-or-later
|
|
*
|
|
* Any future contributions to this file will be taken to be licensed under
|
|
* the Softfloat-2a license unless specifically indicated otherwise.
|
|
*/
|
|
|
|
/*
|
|
* Portions of this work are licensed under the terms of the GNU GPL,
|
|
* version 2 or later. See the COPYING file in the top-level directory.
|
|
*/
|
|
|
|
#ifndef TARGET_M68K_SOFTFLOAT_H
|
|
#define TARGET_M68K_SOFTFLOAT_H
|
|
#include "fpu/softfloat.h"
|
|
|
|
floatx80 floatx80_getman(floatx80 a, float_status *status);
|
|
floatx80 floatx80_getexp(floatx80 a, float_status *status);
|
|
floatx80 floatx80_scale(floatx80 a, floatx80 b, float_status *status);
|
|
floatx80 floatx80_move(floatx80 a, float_status *status);
|
|
floatx80 floatx80_lognp1(floatx80 a, float_status *status);
|
|
floatx80 floatx80_logn(floatx80 a, float_status *status);
|
|
floatx80 floatx80_log10(floatx80 a, float_status *status);
|
|
floatx80 floatx80_log2(floatx80 a, float_status *status);
|
|
floatx80 floatx80_etox(floatx80 a, float_status *status);
|
|
floatx80 floatx80_twotox(floatx80 a, float_status *status);
|
|
floatx80 floatx80_tentox(floatx80 a, float_status *status);
|
|
floatx80 floatx80_tan(floatx80 a, float_status *status);
|
|
floatx80 floatx80_sin(floatx80 a, float_status *status);
|
|
floatx80 floatx80_cos(floatx80 a, float_status *status);
|
|
floatx80 floatx80_atan(floatx80 a, float_status *status);
|
|
floatx80 floatx80_asin(floatx80 a, float_status *status);
|
|
floatx80 floatx80_acos(floatx80 a, float_status *status);
|
|
floatx80 floatx80_atanh(floatx80 a, float_status *status);
|
|
floatx80 floatx80_etoxm1(floatx80 a, float_status *status);
|
|
floatx80 floatx80_tanh(floatx80 a, float_status *status);
|
|
floatx80 floatx80_sinh(floatx80 a, float_status *status);
|
|
floatx80 floatx80_cosh(floatx80 a, float_status *status);
|
|
#endif
|