mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 14:27:59 +02:00
+ added x86_64 asm implementation of math.DivMod
git-svn-id: trunk@36306 -
This commit is contained in:
parent
958d74e41c
commit
30b5a4dd3e
@ -100,6 +100,90 @@ procedure sincos(theta : single;out sinus,cosinus : single);assembler;
|
||||
end;
|
||||
|
||||
|
||||
{$define FPC_MATH_HAS_DIVMOD}
|
||||
{$asmmode intel}
|
||||
procedure DivMod(Dividend: Integer; Divisor: Word; var Result, Remainder: Word);assembler;
|
||||
asm
|
||||
{$ifdef WIN64}
|
||||
mov eax, ecx
|
||||
movzx ecx, dx
|
||||
cdq
|
||||
idiv ecx
|
||||
mov [r8], ax
|
||||
mov [r9], dx
|
||||
{$else WIN64}
|
||||
mov eax, edi
|
||||
movzx esi, si
|
||||
mov rdi, rdx
|
||||
cdq
|
||||
idiv esi
|
||||
mov [rdi], ax
|
||||
mov [rcx], dx
|
||||
{$endif WIN64}
|
||||
end;
|
||||
|
||||
|
||||
procedure DivMod(Dividend: Integer; Divisor: Word; var Result, Remainder: SmallInt);assembler;
|
||||
asm
|
||||
{$ifdef WIN64}
|
||||
mov eax, ecx
|
||||
movzx ecx, dx
|
||||
cdq
|
||||
idiv ecx
|
||||
mov [r8], ax
|
||||
mov [r9], dx
|
||||
{$else WIN64}
|
||||
mov eax, edi
|
||||
movzx esi, si
|
||||
mov rdi, rdx
|
||||
cdq
|
||||
idiv esi
|
||||
mov [rdi], ax
|
||||
mov [rcx], dx
|
||||
{$endif WIN64}
|
||||
end;
|
||||
|
||||
|
||||
procedure DivMod(Dividend: DWord; Divisor: DWord; var Result, Remainder: DWord);assembler;
|
||||
asm
|
||||
{$ifdef WIN64}
|
||||
mov eax, ecx
|
||||
mov ecx, edx
|
||||
xor edx, edx
|
||||
div ecx
|
||||
mov [r8], eax
|
||||
mov [r9], edx
|
||||
{$else WIN64}
|
||||
mov eax, edi
|
||||
mov rdi, rdx
|
||||
xor edx, edx
|
||||
div esi
|
||||
mov [rdi], eax
|
||||
mov [rcx], edx
|
||||
{$endif WIN64}
|
||||
end;
|
||||
|
||||
|
||||
procedure DivMod(Dividend: Integer; Divisor: Integer; var Result, Remainder: Integer);assembler;
|
||||
asm
|
||||
{$ifdef WIN64}
|
||||
mov eax, ecx
|
||||
mov ecx, edx
|
||||
cdq
|
||||
idiv ecx
|
||||
mov [r8], eax
|
||||
mov [r9], edx
|
||||
{$else WIN64}
|
||||
mov eax, edi
|
||||
mov rdi, rdx
|
||||
cdq
|
||||
idiv esi
|
||||
mov [rdi], eax
|
||||
mov [rcx], edx
|
||||
{$endif WIN64}
|
||||
end;
|
||||
|
||||
|
||||
{$asmmode gas}
|
||||
function GetRoundMode: TFPURoundingMode;
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user