mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 09:59:20 +02:00
aggpas: replaced some asm with pas
git-svn-id: trunk@35845 -
This commit is contained in:
parent
65c87531be
commit
f5e46fffd7
@ -365,11 +365,9 @@ type
|
|||||||
// to be.
|
// to be.
|
||||||
procedure NoP;
|
procedure NoP;
|
||||||
|
|
||||||
// SHR for signed integers is differently implemented in pascal compilers
|
{ These implementations have changed to use FPC's Sar*() functions, so should
|
||||||
// than in c++ compilers. On the assembler level, c++ is using the SAR and
|
now support all platforms with ASM code. At a later date these functions
|
||||||
// pascal is using SHR. That gives completely different result, when the
|
could be removed completely. }
|
||||||
// number is negative. We have to be compatible with c++ implementation,
|
|
||||||
// thus instead of directly using SHR we emulate c++ solution.
|
|
||||||
function shr_int8 (i ,shift : int8 ) : int8;
|
function shr_int8 (i ,shift : int8 ) : int8;
|
||||||
function shr_int16(i ,shift : int16 ) : int16;
|
function shr_int16(i ,shift : int16 ) : int16;
|
||||||
function shr_int32(i ,shift : int ) : int;
|
function shr_int32(i ,shift : int ) : int;
|
||||||
@ -1591,90 +1589,22 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
{ SHR_INT8 }
|
{ SHR_INT8 }
|
||||||
function shr_int8;
|
function shr_int8(i ,shift : int8 ) : int8;
|
||||||
begin
|
begin
|
||||||
{$IFDEF AGG_CPU_386 }
|
Result := SarShortint(i, shift);
|
||||||
asm
|
|
||||||
mov al ,byte ptr [i ]
|
|
||||||
mov cl ,byte ptr [shift ]
|
|
||||||
sar al ,cl
|
|
||||||
mov byte ptr [result ] ,al
|
|
||||||
|
|
||||||
end;
|
|
||||||
|
|
||||||
{$ENDIF }
|
|
||||||
|
|
||||||
{$IFDEF AGG_CPU_PPC }
|
|
||||||
asm
|
|
||||||
lbz r2,i
|
|
||||||
extsb r2,r2
|
|
||||||
lbz r3,shift
|
|
||||||
extsb r3,r3
|
|
||||||
sraw r2,r2,r3
|
|
||||||
extsb r2,r2
|
|
||||||
stb r2,result
|
|
||||||
|
|
||||||
end;
|
|
||||||
|
|
||||||
{$ENDIF }
|
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ SHR_INT16 }
|
{ SHR_INT16 }
|
||||||
function shr_int16;
|
function shr_int16(i ,shift : int16 ) : int16;
|
||||||
begin
|
begin
|
||||||
{$IFDEF AGG_CPU_386 }
|
Result := SarSmallint(i, shift);
|
||||||
asm
|
|
||||||
mov ax ,word ptr [i ]
|
|
||||||
mov cx ,word ptr [shift ]
|
|
||||||
sar ax ,cl
|
|
||||||
mov word ptr [result ] ,ax
|
|
||||||
|
|
||||||
end;
|
|
||||||
|
|
||||||
{$ENDIF }
|
|
||||||
|
|
||||||
{$IFDEF AGG_CPU_PPC }
|
|
||||||
asm
|
|
||||||
lha r2,i
|
|
||||||
lha r3,shift
|
|
||||||
sraw r2,r2,r3
|
|
||||||
extsh r2,r2
|
|
||||||
sth r2,result
|
|
||||||
|
|
||||||
end;
|
|
||||||
|
|
||||||
{$ENDIF }
|
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ SHR_INT32 }
|
{ SHR_INT32 }
|
||||||
function shr_int32;
|
function shr_int32(i, shift: int): int;
|
||||||
begin
|
begin
|
||||||
{$IFDEF AGG_CPU_386 }
|
Result := SarLongint(i, shift);
|
||||||
asm
|
|
||||||
mov eax ,dword ptr [i ]
|
|
||||||
mov ecx ,dword ptr [shift ]
|
|
||||||
sar eax ,cl
|
|
||||||
mov dword ptr [result ] ,eax
|
|
||||||
|
|
||||||
end;
|
|
||||||
|
|
||||||
{$ENDIF }
|
|
||||||
|
|
||||||
{$IFDEF AGG_CPU_PPC }
|
|
||||||
asm
|
|
||||||
lwz r3,i
|
|
||||||
lwz r2,shift
|
|
||||||
sraw r3,r3,r2
|
|
||||||
stw r3,result
|
|
||||||
|
|
||||||
end;
|
|
||||||
|
|
||||||
{$ENDIF }
|
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
END.
|
end.
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user