+ Assembler implementation of SarInt64 for i386.

git-svn-id: trunk@25037 -
This commit is contained in:
sergei 2013-07-04 09:43:30 +00:00
parent 7c110e9b42
commit 30a6432a17

View File

@ -1590,3 +1590,25 @@ asm
.L2:
end;
{$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}