From f0b22a1569e315faa4954c7afc00450a35dbf2c8 Mon Sep 17 00:00:00 2001 From: pierre Date: Mon, 16 Nov 2020 17:04:46 +0000 Subject: [PATCH] Revert commit #47257, Disable use of cmov instructions in alignment patterns for some i386 targets (it prevents use of some emulators) Replace it by a new set of i386 targets, for which the default cpu is set to i80486 instead of pentium2 to avoid (for default configuration) use of CMOVxx or PREFETCHyyy instructions, not supported by some emulators. git-svn-id: trunk@47433 - --- compiler/options.pas | 8 ++++++++ compiler/systems.pas | 14 +++++++------- compiler/x86/aasmcpu.pas | 3 +-- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/compiler/options.pas b/compiler/options.pas index 95e7e5c0aa..109703d242 100644 --- a/compiler/options.pas +++ b/compiler/options.pas @@ -4309,6 +4309,14 @@ begin {$endif cpufpemu} {$ifdef i386} + if target_info.system in systems_i386_default_486 then + begin + { Avoid use of MMX/CMOVcc instructions on older systems. + Some systems might not handle these instructions correctly, + Used emulators might also be problematic. PM } + if not option.CPUSetExplicitly then + init_settings.cputype:=cpu_486; + end; case target_info.system of system_i386_android: begin diff --git a/compiler/systems.pas b/compiler/systems.pas index 968c19863a..1828b1dfde 100644 --- a/compiler/systems.pas +++ b/compiler/systems.pas @@ -344,13 +344,13 @@ interface { all native nt systems } systems_nativent = [system_i386_nativent]; - { all i386 systems for which cmov instructions for alignment should not be used. - This is a problem for several emulators } - systems_i386_no_cmov_align = [system_i386_go32v2, - system_i386_watcom, system_i386_wdosx, - system_i386_os2, system_i386_emx, - system_i386_beos, system_i386_haiku, - system_i386_solaris]; + { Default to i80846 instead of pentium2 for all old i386 systems for which + some newer instructions (like CMOVcc or PREFECTXXX) lead to troubles, + related to OS or emulator lack of support. } + systems_i386_default_486 = [system_i386_go32v2, system_i386_watcom, + system_i386_emx, system_i386_wdosx, + system_i386_beos, system_i386_netware, + system_i386_netwlibc, system_i386_symbian]; { systems supporting Objective-C } systems_objc_supported = systems_darwin; diff --git a/compiler/x86/aasmcpu.pas b/compiler/x86/aasmcpu.pas index 61bfa77e14..87d5ac7e0e 100644 --- a/compiler/x86/aasmcpu.pas +++ b/compiler/x86/aasmcpu.pas @@ -965,8 +965,7 @@ implementation while (localsize>0) do begin {$ifndef i8086} - if (CPUX86_HAS_CMOV in cpu_capabilities[current_settings.cputype]) - {$ifdef i386} and not (target_info.system in systems_i386_no_cmov_align) {$endif} then + if (CPUX86_HAS_CMOV in cpu_capabilities[current_settings.cputype]) then begin for j:=low(alignarray_cmovcpus) to high(alignarray_cmovcpus) do if (localsize>=length(alignarray_cmovcpus[j])) then