浏览代码

+ Assembler implementation of SarInt64 for i386.

git-svn-id: trunk@25037 -
sergei 12 年之前
父节点
当前提交
30a6432a17
共有 1 个文件被更改,包括 22 次插入0 次删除
  1. 22 0
      rtl/i386/i386.inc

+ 22 - 0
rtl/i386/i386.inc

@@ -1590,3 +1590,25 @@ asm
 .L2:
 .L2:
 end;
 end;
 {$endif FPC_SYSTEM_HAS_BSR_QWORD}
 {$endif FPC_SYSTEM_HAS_BSR_QWORD}
+
+{$ifndef FPC_SYSTEM_HAS_SAR_QWORD}
+{$define FPC_SYSTEM_HAS_SAR_QWORD}
+function fpc_SarInt64(Const AValue : Int64;const Shift : Byte): Int64; [Public,Alias:'FPC_SARINT64']; compilerproc; assembler; nostackframe;
+asm
+        movb   %al,%cl
+        movl   8(%esp),%edx
+        movl   4(%esp),%eax
+        andb   $63,%cl
+        cmpb   $32,%cl
+        jnb    .L1
+        shrdl  %cl,%edx,%eax
+        sarl   %cl,%edx
+        jmp    .Lexit
+.L1:
+        movl   %edx,%eax
+        sarl   $31,%edx
+        andb   $31,%cl
+        sarl   %cl,%eax
+.Lexit:
+end;
+{$endif FPC_SYSTEM_HAS_SAR_QWORD}