qemu/target/i386
Joseph Myers 5eebc49d2d target/i386: reimplement fyl2xp1 using floatx80 operations
The x87 fyl2xp1 emulation is currently based around conversion to
double.  This is inherently unsuitable for a good emulation of any
floatx80 operation, even before considering that it is a particularly
naive implementation using double (adding 1 then using log rather than
attempting a better emulation using log1p).

Reimplement using the soft-float operations, as was done for f2xm1; as
in that case, m68k has related operations but not exactly this one and
it seemed safest to implement directly rather than reusing the m68k
code to avoid accumulation of errors.

A test is included with many randomly generated inputs.  The
assumption of the test is that the result in round-to-nearest mode
should always be one of the two closest floating-point numbers to the
mathematical value of y * log2(x + 1); the implementation aims to do
somewhat better than that (about 70 correct bits before rounding).  I
haven't investigated how accurate hardware is.

Intel manuals describe a narrower range of valid arguments to this
instruction than AMD manuals.  The implementation accepts the wider
range (it's needed anyway for the core code to be reusable in a
subsequent patch reimplementing fyl2x), but the test only has inputs
in the narrower range so that it's valid on hardware that may reject
or produce poor results for inputs outside that range.

Code in the previous implementation that sets C2 for some out-of-range
arguments is not carried forward to the new implementation; C2 is
undefined for this instruction and I suspect that code was just
cut-and-pasted from the trigonometric instructions (fcos, fptan, fsin,
fsincos) where C2 *is* defined to be set for out-of-range arguments.

Signed-off-by: Joseph Myers <joseph@codesourcery.com>

Message-Id: <alpine.DEB.2.21.2006172320190.20587@digraph.polyomino.org.uk>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-06-26 09:39:38 -04:00
..
hvf i386: hvf: Drop HVFX86EmulatorState 2020-06-12 11:20:12 -04:00
arch_dump.c
arch_memory_mapping.c
bpt_helper.c target/i386: Use env_cpu, env_archcpu 2019-06-10 07:03:42 -07:00
cc_helper.c
cc_helper_template.h
cpu-param.h tcg: Split out target/arch/cpu-param.h 2019-06-10 07:03:34 -07:00
cpu-qom.h cpu: Use DeviceClass reset instead of a special CPUClass reset 2020-03-17 19:48:10 -04:00
cpu.c qdev: Convert bus-less devices to qdev_realize() with Coccinelle 2020-06-15 22:06:04 +02:00
cpu.h i386: hvf: Drop HVFX86EmulatorState 2020-06-12 11:20:12 -04:00
excp_helper.c sysemu: Split sysemu/runstate.h off sysemu/sysemu.h 2019-08-16 13:37:36 +02:00
fpu_helper.c target/i386: reimplement fyl2xp1 using floatx80 operations 2020-06-26 09:39:38 -04:00
gdbstub.c gdbstub: i386: Fix gdb_get_reg16() parameter to unbreak gdb 2020-04-15 11:38:23 +01:00
hax-all.c hax: Dynamic allocate vcpu state structure 2020-06-10 12:09:59 -04:00
hax-i386.h i386: Remove unused define's from hax and hvf 2020-06-10 12:10:47 -04:00
hax-interface.h
hax-mem.c
hax-posix.c i386: Fix GCC warning with snprintf when HAX is enabled 2020-03-16 23:02:24 +01:00
hax-posix.h
hax-windows.c hax: Windows doesn't like posix device names 2020-04-14 10:37:42 -04:00
hax-windows.h
helper.c Fix wrong behavior of cpu_memory_rw_debug() function in SMM 2019-10-04 18:49:18 +02:00
helper.h target/i386: Implement CPUID_EXT_RDRAND 2019-05-22 12:38:54 -04:00
hyperv-proto.h i386/kvm: add NoNonArchitecturalCoreSharing Hyper-V enlightenment 2019-10-22 09:38:42 +02:00
hyperv-stub.c target/i386: fix feature check in hyperv-stub.c 2019-07-05 22:16:46 +02:00
hyperv.c i386/kvm: convert hyperv enlightenments properties from bools to bits 2019-06-21 02:29:38 +02:00
hyperv.h
int_helper.c target/i386: Implement CPUID_EXT_RDRAND 2019-05-22 12:38:54 -04:00
kvm-stub.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
kvm.c target/i386: define a new MSR based feature word - FEAT_PERF_CAPABILITIES 2020-06-10 12:10:47 -04:00
kvm_i386.h target/i386: kvm: initialize feature MSRs very early 2020-01-24 20:59:09 +01:00
machine.c Fix some comment spelling errors. 2019-12-18 02:34:11 +01:00
Makefile.objs
mem_helper.c tcg: Search includes from the project root source directory 2020-01-15 15:13:10 -10:00
misc_helper.c target/i386: Fix OUTL debug output 2020-06-10 12:09:35 -04:00
monitor.c hw: replace hw/i386/pc.h with a header just for the i8259 2019-12-17 19:33:49 +01:00
mpx_helper.c
ops_sse.h target/i386: correct fix for pcmpxstrx substring search 2020-06-12 11:10:39 -04:00
ops_sse_header.h
seg_helper.c target/i386: Use cpu_*_mmuidx_ra instead of templates 2020-01-15 15:13:10 -10:00
sev-stub.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
sev.c target/i386: sev: Unify SEVState and SevGuestState 2020-06-12 11:20:14 -04:00
sev_i386.h target/i386: sev: Move local structure definitions into .c file 2020-06-12 11:20:13 -04:00
shift_helper_template.h
smm_helper.c target/i386: Use env_cpu, env_archcpu 2019-06-10 07:03:42 -07:00
svm.h
svm_helper.c target/i386: Use env_cpu, env_archcpu 2019-06-10 07:03:42 -07:00
trace-events
translate.c linux-user/i386: Emulate x86_64 vsyscalls 2020-03-26 08:08:54 +01:00
whp-dispatch.h WHPX: TSC get and set should be dependent on VM state 2020-03-16 23:02:21 +01:00
whpx-all.c WHPX: Use proper synchronization primitives while processing 2020-03-16 23:02:24 +01:00
xsave_helper.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00