mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-02 17:19:27 +01:00
* x86-64 fixes
This commit is contained in:
parent
cafed35e77
commit
53ec165e68
@ -86,6 +86,7 @@ procedure fpc_AnsiStr_Longword(v : Longword;Len : Longint; Var S : AnsiString);
|
||||
procedure fpc_WideStr_Longint(v : Longint; Len : Longint; Var S : WideString); compilerproc;
|
||||
procedure fpc_WideStr_Longword(v : Longword;Len : Longint; Var S : WideString); compilerproc;
|
||||
{$endif}
|
||||
{$ifndef CPU64}
|
||||
procedure fpc_shortstr_qword(v : qword;len : strlenint;var s : shortstring); compilerproc;
|
||||
procedure fpc_shortstr_int64(v : int64;len : strlenint;var s : shortstring); compilerproc;
|
||||
procedure fpc_chararray_qword(v : qword;len : strlenint;var a : array of char); compilerproc;
|
||||
@ -94,6 +95,7 @@ procedure fpc_ansistr_qword(v : qword;len : strlenint;var s : ansistring); compi
|
||||
procedure fpc_ansistr_int64(v : int64;len : strlenint;var s : ansistring); compilerproc;
|
||||
procedure fpc_widestr_qword(v : qword;len : strlenint;var s : widestring); compilerproc;
|
||||
procedure fpc_widestr_int64(v : int64;len : strlenint;var s : widestring); compilerproc;
|
||||
{$endif CPU64}
|
||||
procedure fpc_ShortStr_Float(d : ValReal;len,fr,rt : strlenint;var s : shortstring); compilerproc;
|
||||
procedure fpc_chararray_Float(d : ValReal;len,fr,rt : strlenint;var a : array of char); compilerproc;
|
||||
procedure fpc_AnsiStr_Float(d : ValReal;len,fr,rt : strlenint;var s : ansistring); compilerproc;
|
||||
@ -103,12 +105,12 @@ procedure fpc_WideStr_Float(d : ValReal;len,fr,rt : strlenint;var s : WideString
|
||||
Function fpc_Val_Real_ShortStr(const s : shortstring; var code : ValSInt): ValReal; compilerproc;
|
||||
Function fpc_Val_Real_AnsiStr(Const S : AnsiString; Var Code : ValSInt): ValReal; compilerproc;
|
||||
Function fpc_Val_Real_WideStr(Const S : WideString; Var Code : ValSInt): ValReal; compilerproc;
|
||||
Function fpc_Val_SInt_ShortStr(DestSize: longint; Const S: ShortString; var Code: ValSInt): ValSInt; compilerproc;
|
||||
Function fpc_Val_SInt_ShortStr(DestSize: StrLenInt; Const S: ShortString; var Code: ValSInt): ValSInt; compilerproc;
|
||||
Function fpc_Val_UInt_Shortstr(Const S: ShortString; var Code: ValSInt): ValUInt; compilerproc;
|
||||
Function fpc_Val_UInt_AnsiStr (Const S : AnsiString; Var Code : ValSInt): ValUInt; compilerproc;
|
||||
Function fpc_Val_SInt_AnsiStr (DestSize: longint; Const S : AnsiString; Var Code : ValSInt): ValSInt; compilerproc;
|
||||
Function fpc_Val_SInt_AnsiStr (DestSize: StrLenInt; Const S : AnsiString; Var Code : ValSInt): ValSInt; compilerproc;
|
||||
Function fpc_Val_UInt_WideStr (Const S : WideString; Var Code : ValSInt): ValUInt; compilerproc;
|
||||
Function fpc_Val_SInt_WideStr (DestSize: longint; Const S : WideString; Var Code : ValSInt): ValSInt; compilerproc;
|
||||
Function fpc_Val_SInt_WideStr (DestSize: StrLenInt; Const S : WideString; Var Code : ValSInt): ValSInt; compilerproc;
|
||||
{$ifndef CPU64}
|
||||
Function fpc_val_int64_shortstr(Const S: ShortString; var Code: ValSInt): Int64; compilerproc;
|
||||
Function fpc_val_qword_shortstr(Const S: ShortString; var Code: ValSInt): QWord; compilerproc;
|
||||
@ -128,18 +130,18 @@ Procedure fpc_ansistr_append_ansistring(Var S : AnsiString;Str : AnsiString); co
|
||||
{$ifdef EXTRAANSISHORT}
|
||||
Procedure fpc_AnsiStr_ShortStr_Concat (Var S1: AnsiString; Var S2 : ShortString); compilerproc;
|
||||
{$endif EXTRAANSISHORT}
|
||||
function fpc_AnsiStr_To_ShortStr (high_of_res: longint;const S2 : Ansistring): shortstring; compilerproc;
|
||||
function fpc_AnsiStr_To_ShortStr (high_of_res: StrLenInt;const S2 : Ansistring): shortstring; compilerproc;
|
||||
Function fpc_ShortStr_To_AnsiStr (Const S2 : ShortString): ansistring; compilerproc;
|
||||
Function fpc_Char_To_AnsiStr(const c : Char): AnsiString; compilerproc;
|
||||
Function fpc_PChar_To_AnsiStr(const p : pchar): ansistring; compilerproc;
|
||||
Function fpc_CharArray_To_AnsiStr(const arr: array of char): ansistring; compilerproc;
|
||||
function fpc_ansistr_to_chararray(arraysize: longint; const src: ansistring): fpc_big_chararray; compilerproc;
|
||||
Function fpc_AnsiStr_Compare(const S1,S2 : AnsiString): Longint; compilerproc;
|
||||
function fpc_ansistr_to_chararray(arraysize: StrLenInt; const src: ansistring): fpc_big_chararray; compilerproc;
|
||||
Function fpc_AnsiStr_Compare(const S1,S2 : AnsiString): StrLenInt; compilerproc;
|
||||
Procedure fpc_AnsiStr_CheckZero(p : pointer); compilerproc;
|
||||
Procedure fpc_AnsiStr_CheckRange(len,index : longint); compilerproc;
|
||||
Procedure fpc_AnsiStr_SetLength (Var S : AnsiString; l : Longint); compilerproc;
|
||||
Procedure fpc_AnsiStr_CheckRange(len,index : StrLenInt); compilerproc;
|
||||
Procedure fpc_AnsiStr_SetLength (Var S : AnsiString; l : StrLenInt); compilerproc;
|
||||
{$ifdef EXTRAANSISHORT}
|
||||
Function fpc_AnsiStr_ShortStr_Compare (Var S1 : Pointer; Var S2 : ShortString): Longint; compilerproc;
|
||||
Function fpc_AnsiStr_ShortStr_Compare (Var S1 : Pointer; Var S2 : ShortString): StrLenInt; compilerproc;
|
||||
{$endif EXTRAANSISHORT}
|
||||
{ pointer argument because otherwise when calling this, we get }
|
||||
{ an endless loop since a 'var s: ansistring' must be made }
|
||||
@ -148,7 +150,7 @@ Function fpc_ansistr_Unique(Var S : Pointer): Pointer; compilerproc;
|
||||
|
||||
Procedure fpc_WideStr_Decr_Ref (Var S : Pointer); compilerproc;
|
||||
Procedure fpc_WideStr_Incr_Ref (S : Pointer); compilerproc;
|
||||
function fpc_WideStr_To_ShortStr (high_of_res: longint;const S2 : WideString): shortstring; compilerproc;
|
||||
function fpc_WideStr_To_ShortStr (high_of_res: StrLenInt;const S2 : WideString): shortstring; compilerproc;
|
||||
Function fpc_ShortStr_To_WideStr (Const S2 : ShortString): WideString; compilerproc;
|
||||
Function fpc_WideStr_To_AnsiStr (const S2 : WideString): AnsiString; compilerproc;
|
||||
Function fpc_AnsiStr_To_WideStr (Const S2 : AnsiString): WideString; compilerproc;
|
||||
@ -157,11 +159,11 @@ Function fpc_WideStr_Concat (const S1,S2 : WideString) : WideString; compilerpro
|
||||
Function fpc_Char_To_WideStr(const c : Char): WideString; compilerproc;
|
||||
Function fpc_PChar_To_WideStr(const p : pchar): WideString; compilerproc;
|
||||
Function fpc_CharArray_To_WideStr(const arr: array of char): WideString; compilerproc;
|
||||
function fpc_widestr_to_chararray(arraysize: longint; const src: WideString): fpc_big_chararray; compilerproc;
|
||||
Function fpc_WideStr_Compare(const S1,S2 : WideString): Longint; compilerproc;
|
||||
function fpc_widestr_to_chararray(arraysize: StrLenInt; const src: WideString): fpc_big_chararray; compilerproc;
|
||||
Function fpc_WideStr_Compare(const S1,S2 : WideString): StrLenInt; compilerproc;
|
||||
Procedure fpc_WideStr_CheckZero(p : pointer); compilerproc;
|
||||
Procedure fpc_WideStr_CheckRange(len,index : longint); compilerproc;
|
||||
Procedure fpc_WideStr_SetLength (Var S : WideString; l : Longint); compilerproc;
|
||||
Procedure fpc_WideStr_CheckRange(len,index : StrLenInt); compilerproc;
|
||||
Procedure fpc_WideStr_SetLength (Var S : WideString; l : StrLenInt); compilerproc;
|
||||
function fpc_widestr_Unique(Var S : Pointer): Pointer; compilerproc;
|
||||
|
||||
{$ifdef HASWIDECHAR}
|
||||
@ -326,7 +328,10 @@ function fpc_qword_to_double(q: qword): double; compilerproc;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.53 2004-04-29 18:59:43 peter
|
||||
Revision 1.54 2004-04-29 19:50:13 peter
|
||||
* x86-64 fixes
|
||||
|
||||
Revision 1.53 2004/04/29 18:59:43 peter
|
||||
* str() helpers now also use valint/valuint
|
||||
* int64/qword helpers disabled for cpu64
|
||||
|
||||
|
||||
@ -1043,20 +1043,39 @@ end;
|
||||
|
||||
{$endif ndef FPC_SYSTEM_HAS_SQR_INT64}
|
||||
|
||||
{$ifndef FPC_SYSTEM_HAS_DECLOCKED}
|
||||
{$ifndef FPC_SYSTEM_HAS_DECLOCKED_LONGINT}
|
||||
function declocked(var l:longint):boolean;
|
||||
begin
|
||||
Dec(l);
|
||||
declocked:=(l=0);
|
||||
end;
|
||||
{$endif FPC_SYSTEM_HAS_DECLOCKED}
|
||||
{$endif FPC_SYSTEM_HAS_DECLOCKED_LONGINT}
|
||||
|
||||
{$ifndef FPC_SYSTEM_HAS_INCLOCKED}
|
||||
|
||||
{$ifndef FPC_SYSTEM_HAS_DECLOCKED_INT64}
|
||||
function declocked(var l:int64):boolean;
|
||||
begin
|
||||
Dec(l);
|
||||
declocked:=(l=0);
|
||||
end;
|
||||
{$endif FPC_SYSTEM_HAS_DECLOCKED_INT64}
|
||||
|
||||
|
||||
{$ifndef FPC_SYSTEM_HAS_INCLOCKED_LONGINT}
|
||||
procedure inclocked(var l:longint);
|
||||
begin
|
||||
Inc(l);
|
||||
end;
|
||||
{$endif FPC_SYSTEM_HAS_INCLOCKED}
|
||||
{$endif FPC_SYSTEM_HAS_INCLOCKED_LONGINT}
|
||||
|
||||
|
||||
{$ifndef FPC_SYSTEM_HAS_INCLOCKED_INT64}
|
||||
procedure inclocked(var l:int64);
|
||||
begin
|
||||
Inc(l);
|
||||
end;
|
||||
{$endif FPC_SYSTEM_HAS_INCLOCKED_INT64}
|
||||
|
||||
|
||||
{$ifndef FPC_SYSTEM_HAS_SPTR}
|
||||
{_$error Sptr must be defined for each processor }
|
||||
@ -1139,7 +1158,10 @@ end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.72 2004-04-28 21:01:29 florian
|
||||
Revision 1.73 2004-04-29 19:50:13 peter
|
||||
* x86-64 fixes
|
||||
|
||||
Revision 1.72 2004/04/28 21:01:29 florian
|
||||
* tvmt fixed (longint -> ptrint)
|
||||
|
||||
Revision 1.71 2004/04/28 20:48:20 peter
|
||||
|
||||
@ -245,14 +245,14 @@ Procedure FillChar(var x;count:longint;value:byte);assembler;
|
||||
end;
|
||||
*)
|
||||
|
||||
{$define FPC_SYSTEM_HAS_DECLOCKED}
|
||||
|
||||
{$define FPC_SYSTEM_HAS_DECLOCKED_LONGINT}
|
||||
{ does a thread save inc/dec }
|
||||
function declocked(var l : longint) : boolean;assembler;
|
||||
asm
|
||||
{
|
||||
l: %rdi
|
||||
}
|
||||
{$ifdef MT}
|
||||
{ this check should be done because a lock takes a lot }
|
||||
{ of time! }
|
||||
cmpb $0,IsMultithread
|
||||
@ -261,20 +261,39 @@ function declocked(var l : longint) : boolean;assembler;
|
||||
decl (%rdi)
|
||||
jmp .Ldeclockedend
|
||||
.Ldeclockednolock:
|
||||
{$endif MT}
|
||||
decl (%rdi)
|
||||
.Ldeclockedend:
|
||||
setzb %al
|
||||
end;
|
||||
|
||||
{$define FPC_SYSTEM_HAS_INCLOCKED}
|
||||
|
||||
{$define FPC_SYSTEM_HAS_DECLOCKED_INT64}
|
||||
function declocked(var l : int64) : boolean;assembler;
|
||||
asm
|
||||
{
|
||||
l: %rdi
|
||||
}
|
||||
{ this check should be done because a lock takes a lot }
|
||||
{ of time! }
|
||||
cmpb $0,IsMultithread
|
||||
jz .Ldeclockednolock
|
||||
lock
|
||||
decq (%rdi)
|
||||
jmp .Ldeclockedend
|
||||
.Ldeclockednolock:
|
||||
decq (%rdi)
|
||||
.Ldeclockedend:
|
||||
setzb %al
|
||||
end;
|
||||
|
||||
|
||||
{$define FPC_SYSTEM_HAS_INCLOCKED_LONGINT}
|
||||
procedure inclocked(var l : longint);assembler;
|
||||
|
||||
asm
|
||||
{
|
||||
l: %rdi
|
||||
}
|
||||
{$ifdef MT}
|
||||
{ this check should be done because a lock takes a lot }
|
||||
{ of time! }
|
||||
cmpb $0,IsMultithread
|
||||
@ -283,11 +302,31 @@ procedure inclocked(var l : longint);assembler;
|
||||
incl (%rdi)
|
||||
jmp .Linclockedend
|
||||
.Linclockednolock:
|
||||
{$endif MT}
|
||||
incl (%rdi)
|
||||
.Linclockedend:
|
||||
end;
|
||||
|
||||
|
||||
{$define FPC_SYSTEM_HAS_INCLOCKED_INT64}
|
||||
procedure inclocked(var l : int64);assembler;
|
||||
|
||||
asm
|
||||
{
|
||||
l: %rdi
|
||||
}
|
||||
{ this check should be done because a lock takes a lot }
|
||||
{ of time! }
|
||||
cmpb $0,IsMultithread
|
||||
jz .Linclockednolock
|
||||
lock
|
||||
incq (%rdi)
|
||||
jmp .Linclockedend
|
||||
.Linclockednolock:
|
||||
incl (%rdi)
|
||||
.Linclockedend:
|
||||
end;
|
||||
|
||||
|
||||
{****************************************************************************
|
||||
FPU
|
||||
****************************************************************************}
|
||||
@ -306,7 +345,10 @@ const
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.10 2004-04-26 15:55:01 peter
|
||||
Revision 1.11 2004-04-29 19:50:13 peter
|
||||
* x86-64 fixes
|
||||
|
||||
Revision 1.10 2004/04/26 15:55:01 peter
|
||||
* FPC_MOVE alias
|
||||
|
||||
Revision 1.9 2004/04/22 20:20:16 peter
|
||||
|
||||
Loading…
Reference in New Issue
Block a user