target-ppc: keep only the table version for mfrom
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6007 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
be94c952e4
commit
5e9ae189f8
|
@ -1865,30 +1865,16 @@ void helper_rfsvc (void)
|
||||||
/* 602 specific instructions */
|
/* 602 specific instructions */
|
||||||
/* mfrom is the most crazy instruction ever seen, imho ! */
|
/* mfrom is the most crazy instruction ever seen, imho ! */
|
||||||
/* Real implementation uses a ROM table. Do the same */
|
/* Real implementation uses a ROM table. Do the same */
|
||||||
|
/* Extremly decomposed:
|
||||||
|
* -arg / 256
|
||||||
|
* return 256 * log10(10 + 1.0) + 0.5
|
||||||
|
*/
|
||||||
#if !defined (CONFIG_USER_ONLY)
|
#if !defined (CONFIG_USER_ONLY)
|
||||||
#define USE_MFROM_ROM_TABLE
|
|
||||||
target_ulong helper_602_mfrom (target_ulong arg)
|
target_ulong helper_602_mfrom (target_ulong arg)
|
||||||
{
|
{
|
||||||
if (likely(arg < 602)) {
|
if (likely(arg < 602)) {
|
||||||
#if defined(USE_MFROM_ROM_TABLE)
|
|
||||||
#include "mfrom_table.c"
|
#include "mfrom_table.c"
|
||||||
return mfrom_ROM_table[arg];
|
return mfrom_ROM_table[arg];
|
||||||
#else
|
|
||||||
double d;
|
|
||||||
/* Extremly decomposed:
|
|
||||||
* -arg / 256
|
|
||||||
* return 256 * log10(10 + 1.0) + 0.5
|
|
||||||
*/
|
|
||||||
d = arg;
|
|
||||||
d = float64_div(d, 256, &env->fp_status);
|
|
||||||
d = float64_chs(d);
|
|
||||||
d = exp10(d); // XXX: use float emulation function
|
|
||||||
d = float64_add(d, 1.0, &env->fp_status);
|
|
||||||
d = log10(d); // XXX: use float emulation function
|
|
||||||
d = float64_mul(d, 256, &env->fp_status);
|
|
||||||
d = float64_add(d, 0.5, &env->fp_status);
|
|
||||||
return float64_round_to_int(d, &env->fp_status);
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue