瀏覽代碼

* Added CLDs in the RTL i386 inline asm routines, wrapped in {$ifdef
FPC_ENABLED_CLD}.

git-svn-id: trunk@25606 -

nickysn 12 年之前
父節點
當前提交
4b3bf874df
共有 3 個文件被更改,包括 74 次插入0 次删除
  1. 6 0
      rtl/i386/fastmove.inc
  2. 26 0
      rtl/i386/i386.inc
  3. 42 0
      rtl/i386/set.inc

+ 6 - 0
rtl/i386/fastmove.inc

@@ -373,6 +373,9 @@ end; {SmallBackwardMove}
 }
 procedure Forwards_Valgrind;assembler;nostackframe;
 asm
+{$ifdef FPC_ENABLED_CLD}
+  cld
+{$endif FPC_ENABLED_CLD}
   push    esi
   push    edi
   mov     esi,eax
@@ -545,6 +548,9 @@ asm
   add     eax,8
   jnz     @MMXcopyloop
   emms                   {Empty MMX State}
+{$ifdef FPC_ENABLED_CLD}
+  cld
+{$endif FPC_ENABLED_CLD}
   add     ecx,ebx
   shr     ecx,2
   rep     movsd

+ 26 - 0
rtl/i386/i386.inc

@@ -159,7 +159,9 @@ asm
         jb      .LBMove                 { Dest is in range of move, do backward }
 { Forward Copy }
 .LFMove:
+{$ifdef FPC_ENABLED_CLD}
         cld
+{$endif FPC_ENABLED_CLD}
         cmpl    $15,%edx
         jl      .LFMove1
         movl    %edi,%ecx       { Align on 32bits }
@@ -233,7 +235,9 @@ asm
         ret
 
 .LFillFull:
+{$ifdef FPC_ENABLED_CLD}
         cld
+{$endif FPC_ENABLED_CLD}
         push    %edi
         movl    %eax,%edi
         movzbl  %cl,%eax
@@ -271,7 +275,9 @@ asm
         orl     %edx,%eax
         movl    %ecx,%edx
         shrl    $1,%ecx
+{$ifdef FPC_ENABLED_CLD}
         cld
+{$endif FPC_ENABLED_CLD}
         rep
         stosl
         movl    %edx,%ecx
@@ -297,7 +303,9 @@ asm
 { check for zero or negative count }
         cmpl    $0,%ecx
         jle     .LFillDWordEnd
+{$ifdef FPC_ENABLED_CLD}
         cld
+{$endif FPC_ENABLED_CLD}
         rep
         stosl
 .LFillDWordEnd:
@@ -453,7 +461,9 @@ asm
         xorl    %eax,%eax
         testl   %ecx,%ecx
         jz      .Lcharposnotfound
+{$ifdef FPC_ENABLED_CLD}
         cld
+{$endif FPC_ENABLED_CLD}
         movl    %ecx,%edx      // Copy for easy manipulation
         movw    %bx,%ax
         repne
@@ -486,7 +496,9 @@ asm
         xorl    %eax,%eax
         testl   %ecx,%ecx
         jz      .Lcharposnotfound
+{$ifdef FPC_ENABLED_CLD}
         cld
+{$endif FPC_ENABLED_CLD}
         movl    %ecx,%edx      // Copy for easy manipulation
         movl    %ebx,%eax
         repne
@@ -537,7 +549,9 @@ asm
 .LCmpbyteFull:
         pushl   %esi
         pushl   %edi
+{$ifdef FPC_ENABLED_CLD}
         cld
+{$endif FPC_ENABLED_CLD}
         movl    %eax,%edi
         movl    %edx,%esi
         movl    %ecx,%eax
@@ -610,7 +624,9 @@ asm
         pushl   %esi
         pushl   %edi
         pushl   %ebx
+{$ifdef FPC_ENABLED_CLD}
         cld
+{$endif FPC_ENABLED_CLD}
         movl    %eax,%edi
         movl    %edx,%esi
         movl    %ecx,%eax
@@ -698,7 +714,9 @@ asm
 .LCmpDWordFull:
         pushl   %esi
         pushl   %edi
+{$ifdef FPC_ENABLED_CLD}
         cld
+{$endif FPC_ENABLED_CLD}
         movl    %eax,%edi
         movl    %edx,%esi
         xorl    %eax,%eax
@@ -777,7 +795,9 @@ procedure fpc_shortstr_to_shortstr(out res:shortstring; const sstr: shortstring)
   {$endif FPC_PROFILE}
         movl    %edi,saveedi
         movl    %esi,saveesi
+{$ifdef FPC_ENABLED_CLD}
         cld
+{$endif FPC_ENABLED_CLD}
         movl    res,%edi
         movl    sstr,%esi
         movl    %edx,%ecx
@@ -824,7 +844,9 @@ begin
   {$endif FPC_PROFILE}
         pushl   %eax
         pushl   %ecx
+{$ifdef FPC_ENABLED_CLD}
         cld
+{$endif FPC_ENABLED_CLD}
         movl    dstr,%edi
         movl    sstr,%esi
         xorl    %eax,%eax
@@ -879,7 +901,9 @@ asm
         movl    %edi,saveedi
         movl    %esi,saveesi
         movl    %ebx,saveebx
+{$ifdef FPC_ENABLED_CLD}
         cld
+{$endif FPC_ENABLED_CLD}
         movl    right,%esi
         movl    left,%edi
         movzbl  (%esi),%eax
@@ -1049,7 +1073,9 @@ asm
         movl    %eax,%edi
         movl    $0xffffffff,%ecx
         xorl    %eax,%eax
+{$ifdef FPC_ENABLED_CLD}
         cld
+{$endif FPC_ENABLED_CLD}
         repne
         scasb
         movl    $0xfffffffe,%eax

+ 42 - 0
rtl/i386/set.inc

@@ -32,6 +32,9 @@ asm
         movl    %edi,saveedi
         movl    __RESULT,%edi
         movl    l,%eax
+{$ifdef FPC_ENABLED_CLD}
+        cld
+{$endif FPC_ENABLED_CLD}
         stosl
         xorl    %eax,%eax
         movl    $7,%ecx
@@ -54,6 +57,9 @@ asm
         movzbl  b,%edx
         xorl    %eax,%eax
         movl    $8,%ecx
+{$ifdef FPC_ENABLED_CLD}
+        cld
+{$endif FPC_ENABLED_CLD}
         rep
         stosl
         leal    -32(%edi),%eax
@@ -76,6 +82,9 @@ asm
         movl    __RESULT,%edi
         movzbl  b,%edx
         movl    $8,%ecx
+{$ifdef FPC_ENABLED_CLD}
+        cld
+{$endif FPC_ENABLED_CLD}
         rep
         movsl
         leal    -32(%edi),%eax
@@ -98,6 +107,9 @@ asm
         movl    __RESULT,%edi
         movzbl  b,%edx
         movl    $8,%ecx
+{$ifdef FPC_ENABLED_CLD}
+        cld
+{$endif FPC_ENABLED_CLD}
         rep
         movsl
         leal    -32(%edi),%eax
@@ -126,6 +138,9 @@ asm
         movb   %bl,saveh
         movl   $8,%ecx              // we have to copy 32 bytes
         cmpl   %eax,%ebx            // high < low?
+{$ifdef FPC_ENABLED_CLD}
+        cld
+{$endif FPC_ENABLED_CLD}
         rep                         // copy source to dest (it's possible to do the range
         movsl                       // setting and copying simultanuously of course, but
                                     // that would result in many more jumps and code)
@@ -205,6 +220,9 @@ asm
       movl set2,%edx
       movl __RESULT,%edi
 {$endif}
+{$ifdef FPC_ENABLED_CLD}
+      cld
+{$endif FPC_ENABLED_CLD}
       movl $8,%ecx
    .LMADDSETS1:
       lodsl
@@ -238,6 +256,9 @@ asm
       movl set2,%edx
       movl __RESULT,%edi
 {$endif}
+{$ifdef FPC_ENABLED_CLD}
+      cld
+{$endif FPC_ENABLED_CLD}
       movl $8,%ecx
   .LMMULSETS1:
       lodsl
@@ -272,6 +293,9 @@ asm
         movl set2,%ebx
       movl __RESULT,%edi
 {$endif}
+{$ifdef FPC_ENABLED_CLD}
+        cld
+{$endif FPC_ENABLED_CLD}
         movl $8,%ecx
     .LMSUBSETS1:
         lodsl
@@ -308,6 +332,9 @@ asm
         movl set2,%edx
       movl __RESULT,%edi
 {$endif}
+{$ifdef FPC_ENABLED_CLD}
+        cld
+{$endif FPC_ENABLED_CLD}
         movl $8,%ecx
     .LMSYMDIFSETS1:
         lodsl
@@ -437,6 +464,9 @@ asm
       movl set2,%ebx
       movl dest,%edi
       movl size,%ecx
+{$ifdef FPC_ENABLED_CLD}
+      cld
+{$endif FPC_ENABLED_CLD}
   .LMADDSETSIZES1:
       lodsl
       orl (%ebx),%eax
@@ -457,6 +487,9 @@ asm
          movl set2,%ebx
          movl dest,%edi
          movl size,%ecx
+{$ifdef FPC_ENABLED_CLD}
+         cld
+{$endif FPC_ENABLED_CLD}
      .LMMULSETSIZES1:
          lodsl
          andl (%ebx),%eax
@@ -473,6 +506,9 @@ asm
          movl set2,%ebx
          movl dest,%edi
          movl size,%ecx
+{$ifdef FPC_ENABLED_CLD}
+         cld
+{$endif FPC_ENABLED_CLD}
      .LMSUBSETSIZES1:
          lodsl
          movl (%ebx),%edx
@@ -494,6 +530,9 @@ asm
       movl set2,%ebx
       movl dest,%edi
       movl size,%ecx
+{$ifdef FPC_ENABLED_CLD}
+      cld
+{$endif FPC_ENABLED_CLD}
   .LMSYMDIFSETSIZE1:
       lodsl
       movl (%ebx),%edx
@@ -510,6 +549,9 @@ asm
       movl set1,%esi
       movl set2,%edi
       movl size,%ecx
+{$ifdef FPC_ENABLED_CLD}
+      cld
+{$endif FPC_ENABLED_CLD}
   .LMCOMPSETSIZES1:
       lodsl
       movl (%edi),%edx