Browse Source

x86: MovMovMov2XChg optimisation now makes use of the CPUX86_HAS_FAST_XCHG flag

J. Gareth "Curious Kit" Moreton 2 years ago
parent
commit
e942c00f82
1 changed files with 2 additions and 9 deletions
  1. 2 9
      compiler/x86/aoptx86.pas

+ 2 - 9
compiler/x86/aoptx86.pas

@@ -8611,17 +8611,10 @@ unit aoptx86;
        begin
        begin
          { Always accept if optimising for size }
          { Always accept if optimising for size }
          Result := (cs_opt_size in current_settings.optimizerswitches) or
          Result := (cs_opt_size in current_settings.optimizerswitches) or
-           (
-{$ifdef x86_64}
-             { XCHG takes 3 cycles on AMD Athlon64 }
-             (current_settings.optimizecputype >= cpu_core_i)
-{$else x86_64}
-             { From the Pentium M onwards, XCHG only has a latency of 2 rather
+           { From the Pentium M onwards, XCHG only has a latency of 2 rather
              than 3, so it becomes a saving compared to three MOVs with two of
              than 3, so it becomes a saving compared to three MOVs with two of
              them able to execute simultaneously. [Kit] }
              them able to execute simultaneously. [Kit] }
-             (current_settings.optimizecputype >= cpu_PentiumM)
-{$endif x86_64}
-           );
+           (CPUX86_HAS_FAST_XCHG in cpu_capabilities[current_settings.optimizecputype]);
        end;
        end;
 
 
       var
       var