Pārlūkot izejas kodu

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 -

pierre 4 gadi atpakaļ
vecāks
revīzija
f0b22a1569
3 mainītis faili ar 16 papildinājumiem un 9 dzēšanām
  1. 8 0
      compiler/options.pas
  2. 7 7
      compiler/systems.pas
  3. 1 2
      compiler/x86/aasmcpu.pas

+ 8 - 0
compiler/options.pas

@@ -4309,6 +4309,14 @@ begin
 {$endif cpufpemu}
 {$endif cpufpemu}
 
 
 {$ifdef i386}
 {$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
   case target_info.system of
     system_i386_android:
     system_i386_android:
       begin
       begin

+ 7 - 7
compiler/systems.pas

@@ -344,13 +344,13 @@ interface
        { all native nt systems }
        { all native nt systems }
        systems_nativent = [system_i386_nativent];
        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 supporting Objective-C }
        systems_objc_supported = systems_darwin;
        systems_objc_supported = systems_darwin;

+ 1 - 2
compiler/x86/aasmcpu.pas

@@ -965,8 +965,7 @@ implementation
            while (localsize>0) do
            while (localsize>0) do
             begin
             begin
 {$ifndef i8086}
 {$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
                 begin
                   for j:=low(alignarray_cmovcpus) to high(alignarray_cmovcpus) do
                   for j:=low(alignarray_cmovcpus) to high(alignarray_cmovcpus) do
                    if (localsize>=length(alignarray_cmovcpus[j])) then
                    if (localsize>=length(alignarray_cmovcpus[j])) then