* force to use ATT or direct parsing

This commit is contained in:
peter 1998-05-31 14:15:47 +00:00
parent 128212755c
commit 12f6e38140
5 changed files with 464 additions and 654 deletions

View File

@ -448,6 +448,7 @@ begin
end; end;
{$ASMMODE DIRECT}
function strpas(p:pchar):string; function strpas(p:pchar):string;
begin begin
asm asm
@ -483,6 +484,8 @@ begin
movsb movsb
end ['ECX','EAX','ESI','EDI']; end ['ECX','EAX','ESI','EDI'];
end; end;
{$ASMMODE ATT}
function strlen(p:pchar):longint;assembler; function strlen(p:pchar):longint;assembler;
asm asm
@ -708,6 +711,7 @@ begin
end; end;
{$I386_ATT} {can be removed}
Function Random(L: LongInt): LongInt;assembler; Function Random(L: LongInt): LongInt;assembler;
asm asm
@ -719,11 +723,16 @@ asm
movl %edx,%eax movl %edx,%eax
end; end;
{$I386_DIRECT} {$I386_DIRECT} {can be removed}
{$ASMMODE ATT}
{ {
$Log$ $Log$
Revision 1.11 1998-05-30 14:30:21 peter Revision 1.12 1998-05-31 14:15:47 peter
* force to use ATT or direct parsing
Revision 1.11 1998/05/30 14:30:21 peter
* force att reading * force att reading
Revision 1.10 1998/05/25 10:40:49 peter Revision 1.10 1998/05/25 10:40:49 peter
@ -740,118 +749,4 @@ end;
Revision 1.2 1998/04/08 07:53:31 michael Revision 1.2 1998/04/08 07:53:31 michael
+ Changed Random() function. Moved from system to processor dependent files (from Pedro Gimeno) + Changed Random() function. Moved from system to processor dependent files (from Pedro Gimeno)
Revision 1.1.1.1 1998/03/25 11:18:43 root
* Restored version
Revision 1.30 1998/03/20 05:11:17 carl
* bugfix of register usage list for strcmp and strconcat
Revision 1.29 1998/03/15 19:38:41 peter
* fixed a bug in Move()
Revision 1.28 1998/03/10 23:50:39 florian
* strcopy saves now the used registers except ESI and EDI, solves
a problem with the optimizer
Revision 1.27 1998/03/10 16:25:52 jonas
* removed reloading of eax with 8(ebp), in int_help_constructor, as eax is nowhere modified
Revision 1.25 1998/03/02 11:44:43 florian
* writing of large cardinals fixed
Revision 1.24 1998/03/02 04:14:02 carl
* page fault bug fix with CHECK_OBJECT
warning: Will only work with GAS as VMT pointer field is an
.lcomm and will be ZEROED by linker (might not be true for TASM)
Revision 1.23 1998/02/24 17:50:46 peter
* upto 100% (255's char is different ;) faster STRCMP
* faster StrPas from i386.inc also strings.pp
Revision 1.22 1998/02/22 22:01:26 carl
+ IOCHECK halts with the correct errorcode now
Revision 1.21 1998/02/11 16:55:14 michael
fixed cardinal printing. Large cardinals (>0fffffff) not yet working
Revision 1.20 1998/02/06 09:12:39 florian
* bug in CHECK_OBJECT fixed
Revision 1.19 1998/02/05 22:30:25 florian
+ CHECK_OBJECT to check for an valid VMT (before calling a virtual method)
Revision 1.18 1998/02/04 14:46:36 daniel
* Some small tweaks
Revision 1.17 1998/01/27 22:05:07 florian
* again small fixes to DOM (Delphi Object Model)
Revision 1.16 1998/01/26 11:59:01 michael
+ Added log at the end
revision 1.15
date: 1998/01/25 22:52:52; author: peter; state: Exp; lines: +140 -122
* Faster string functions by using aligning
----------------------------
revision 1.14
date: 1998/01/25 22:30:48; author: florian; state: Exp; lines: +14 -2
* DOM: some fixes to tobject and the con-/destructor help routines
----------------------------
revision 1.13
date: 1998/01/23 18:08:29; author: florian; state: Exp; lines: +10 -4
* more bugs in FCL object model removed
----------------------------
revision 1.12
date: 1998/01/23 15:54:47; author: florian; state: Exp; lines: +5 -5
+ small extensions to FCL object model
----------------------------
revision 1.11
date: 1998/01/20 00:14:24; author: peter; state: Exp; lines: +18 -5
* .type is linux only, go32v2 doesn't like it
----------------------------
revision 1.10
date: 1998/01/19 16:19:53; author: peter; state: Exp; lines: +7 -1
* Works now correct with shared libs, .globl always needs a .type
----------------------------
revision 1.9
date: 1998/01/19 10:21:35; author: michael; state: Exp; lines: +1 -6
* moved Fillchar t(..,char) to system.inc
----------------------------
revision 1.8
date: 1998/01/19 09:15:05; author: michael; state: Exp; lines: +40 -132
* Bugfixes in Move and FillChar
----------------------------
revision 1.7
date: 1998/01/16 23:10:52; author: florian; state: Exp; lines: +23 -1
+ some tobject stuff
----------------------------
revision 1.6
date: 1998/01/16 22:21:35; author: michael; state: Exp; lines: +601 -493
+ Installed pentium-optimized move (optional)
----------------------------
revision 1.5
date: 1998/01/12 03:39:17; author: carl; state: Exp; lines: +2 -2
* bugfix of RE_OVERFLOW, gives out now a Runerror(215)
----------------------------
revision 1.4
date: 1998/01/01 16:57:36; author: michael; state: Exp; lines: +1 -21
Moved DO_EXIT to system.inc. Now processor independent
----------------------------
revision 1.3
date: 1997/12/10 12:12:31; author: michael; state: Exp; lines: +2 -2
* changed dateifunc to FileFunc
----------------------------
revision 1.2
date: 1997/12/01 12:34:36; author: michael; state: Exp; lines: +13 -0
+ added copyright reference in header.
----------------------------
revision 1.1
date: 1997/11/27 08:33:48; author: michael; state: Exp;
Initial revision
----------------------------
revision 1.1.1.1
date: 1997/11/27 08:33:48; author: michael; state: Exp; lines: +0 -0
FPC RTL CVS start
=============================================================================
} }

View File

@ -1,7 +1,9 @@
{ {
$Id$ $Id$
This file is part of the Free Pascal run time library. This file is part of the Free Pascal run time library.
Copyright (c) 1993,97 by the Free Pascal development team Copyright (c) 1993-98 by the Free Pascal development team
Implementation of mathamatical Routines (only for real)
See the file COPYING.FPC, included in this distribution, See the file COPYING.FPC, included in this distribution,
for details about the copyright. for details about the copyright.
@ -12,7 +14,7 @@
**********************************************************************} **********************************************************************}
{ Implementation of mathamatical Routines (only for real) } {$ASMMODE DIRECT}
function abs(d : real) : real; function abs(d : real) : real;
@ -367,51 +369,11 @@
{$endif} {$endif}
{$ASMMODE ATT}
{ {
$Log$ $Log$
Revision 1.1 1998-03-25 11:18:42 root Revision 1.2 1998-05-31 14:15:49 peter
Initial revision * force to use ATT or direct parsing
Revision 1.9 1998/02/04 14:40:31 daniel
* Translated abs for fixed to assembler.
Revision 1.8 1998/01/27 12:44:48 peter
* removed comment level 2 warning
Revision 1.7 1998/01/26 11:59:04 michael
+ Added log at the end
Working file: rtl/i386/math.inc
description:
----------------------------
revision 1.6
date: 1998/01/20 15:12:27; author: peter; state: Exp; lines: +4 -3
* fixes bug 65
----------------------------
revision 1.5
date: 1997/12/01 12:34:37; author: michael; state: Exp; lines: +11 -4
+ added copyright reference in header.
----------------------------
revision 1.4
date: 1997/11/28 23:26:44; author: florian; state: Exp; lines: +34 -33
$ifdef fixed added
----------------------------
revision 1.3
date: 1997/11/28 19:46:11; author: pierre; state: Exp; lines: +360 -358
+ fixed math in define (does not compile yet)
----------------------------
revision 1.2
date: 1997/11/28 16:50:04; author: carl; state: Exp; lines: +358 -278
+ added fixes point routines.
----------------------------
revision 1.1
date: 1997/11/27 08:33:48; author: michael; state: Exp;
Initial revision
----------------------------
revision 1.1.1.1
date: 1997/11/27 08:33:48; author: michael; state: Exp; lines: +0 -0
FPC RTL CVS start
=============================================================================
} }

View File

@ -52,6 +52,8 @@ unit mmx;
uses uses
cpu; cpu;
{$ASMMODE DIRECT}
{ returns true, if the processor supports the mmx instructions } { returns true, if the processor supports the mmx instructions }
function mmx_support : boolean; function mmx_support : boolean;
@ -64,7 +66,7 @@ unit mmx;
asm asm
movl $1,%eax movl $1,%eax
cpuid cpuid
movl %edx,-4(%ebp) // _edx is ebp-4 movl %edx,_edx
end; end;
mmx_support:=(_edx and $800000)<>0; mmx_support:=(_edx and $800000)<>0;
end end
@ -84,7 +86,7 @@ unit mmx;
asm asm
movl $0x80000001,%eax movl $0x80000001,%eax
cpuid cpuid
movl %edx,-4(%ebp) // _edx is ebp-4 movl %edx,_edx
end; end;
amd_3d_support:=(_edx and $80000000)<>0; amd_3d_support:=(_edx and $80000000)<>0;
end end
@ -92,6 +94,7 @@ unit mmx;
{ a cpu with without cpuid instruction supports never mmx } { a cpu with without cpuid instruction supports never mmx }
amd_3d_support:=false; amd_3d_support:=false;
end; end;
procedure emms;assembler; procedure emms;assembler;
asm asm
@ -120,34 +123,8 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.1 1998-03-25 11:18:43 root Revision 1.2 1998-05-31 14:15:50 peter
Initial revision * force to use ATT or direct parsing
Revision 1.7 1998/03/24 09:32:57 peter
* fixed comments
Revision 1.6 1998/03/22 12:41:51 florian
* fix of amd_3d_support procedure
Revision 1.5 1998/03/20 23:27:48 florian
+ some AMD 3D support:
single type and detection of AMD 3D
Revision 1.4 1998/03/03 22:47:01 florian
* small problems fixed
Revision 1.3 1998/02/09 23:48:18 florian
+ exit handler added (executes emms)
+ is_mmx_cpu variable added
Revision 1.2 1998/02/05 22:30:48 florian
+ types for fixed mmx type
Revision 1.1 1998/02/04 23:00:30 florian
+ Initial revision
+ basic data types
+ emms procedure
+ mmx detection from unit cpu inserted
} }

View File

@ -3,6 +3,8 @@
This file is part of the Free Pascal run time library. This file is part of the Free Pascal run time library.
Copyright (c) 1993,97 by the Free Pascal development team Copyright (c) 1993,97 by the Free Pascal development team
Include file with set operations called by the compiler
See the file COPYING.FPC, included in this distribution, See the file COPYING.FPC, included in this distribution,
for details about the copyright. for details about the copyright.
@ -12,15 +14,13 @@
**********************************************************************} **********************************************************************}
{ include file with procedures used for set operations } {$ASMMODE ATT}
{ these procedures should never be called directly }
{ the compiler calls them }
{ add the element b to the set pointed by p } procedure do_set(p : pointer;b : byte); [public,alias: 'SET_SET_BYTE'];
procedure do_set(p : pointer;b : byte); {
[public,alias: 'SET_SET_BYTE']; add the element b to the set pointed by p
}
begin begin
asm asm
pushl %eax pushl %eax
movl p,%edi movl p,%edi
@ -36,12 +36,15 @@
leave leave
ret $6 ret $6
end; end;
end; end;
{ bad implementation, but it's very seldom used }
procedure do_set(p : pointer;l,h : byte);[public,alias: 'SET_SET_RANGE'];
begin {$ASMMODE DIRECT}
procedure do_set(p : pointer;l,h : byte);[public,alias: 'SET_SET_RANGE'];
{
bad implementation, but it's very seldom used
}
begin
asm asm
pushl %eax pushl %eax
xorl %eax,%eax xorl %eax,%eax
@ -57,15 +60,15 @@
.LSET_SET_RANGE_EXIT: .LSET_SET_RANGE_EXIT:
popl %eax popl %eax
end; end;
end; end;
{$ASMMODE ATT}
{ tests if the element b is in the set p }
{ the carryflag is set if it present }
procedure do_in(p : pointer;b : byte); procedure do_in(p : pointer;b : byte);[public,alias: 'SET_IN_BYTE'];
[public,alias: 'SET_IN_BYTE']; {
tests if the element b is in the set p the carryflag is set if it present
begin }
begin
asm asm
pushl %eax pushl %eax
movl p,%edi movl p,%edi
@ -81,12 +84,15 @@
leave leave
ret $6 ret $6
end; end;
end; end;
{ adds set1 and set2 into set dest }
procedure add_sets(set1,set2,dest : pointer);[public,alias: 'SET_ADD_SETS'];
begin
procedure add_sets(set1,set2,dest : pointer);[public,alias: 'SET_ADD_SETS'];
{
adds set1 and set2 into set dest
}
begin
asm asm
movl 8(%ebp),%esi movl 8(%ebp),%esi
movl 12(%ebp),%ebx movl 12(%ebp),%ebx
@ -100,15 +106,14 @@
decl %ecx decl %ecx
jnz .LMADDSETS1 jnz .LMADDSETS1
end; end;
end; end;
{ multiplies (i.E. takes common elements of) set1 and set2 } { multiplies (i.E. takes common elements of) set1 and set2 }
{ result put in dest } { result put in dest }
procedure mul_sets(set1,set2,dest : pointer);[public,alias: 'SET_MUL_SETS']; procedure mul_sets(set1,set2,dest : pointer);[public,alias: 'SET_MUL_SETS'];
begin
begin
asm asm
movl 8(%ebp),%esi movl 8(%ebp),%esi
movl 12(%ebp),%ebx movl 12(%ebp),%ebx
@ -122,14 +127,14 @@
decl %ecx decl %ecx
jnz .LMMULSETS1 jnz .LMMULSETS1
end; end;
end; end;
{ computes the diff from set1 to set2 }
{ result in dest }
procedure sub_sets(set1,set2,dest : pointer);[public,alias: 'SET_SUB_SETS']; procedure sub_sets(set1,set2,dest : pointer);[public,alias: 'SET_SUB_SETS'];
{
begin computes the diff from set1 to set2 result in dest
}
begin
asm asm
movl 8(%ebp),%esi movl 8(%ebp),%esi
movl 12(%ebp),%ebx movl 12(%ebp),%ebx
@ -145,14 +150,14 @@
decl %ecx decl %ecx
jnz .LMSUBSETS1 jnz .LMSUBSETS1
end; end;
end; end;
{ computes the symetric diff from set1 to set2 }
{ result in dest }
procedure sym_sub_sets(set1,set2,dest : pointer);[public,alias: 'SET_SYMDIF_SETS']; procedure sym_sub_sets(set1,set2,dest : pointer);[public,alias: 'SET_SYMDIF_SETS'];
{
begin computes the symetric diff from set1 to set2 result in dest
}
begin
asm asm
movl 8(%ebp),%esi movl 8(%ebp),%esi
movl 12(%ebp),%ebx movl 12(%ebp),%ebx
@ -167,13 +172,13 @@
decl %ecx decl %ecx
jnz .LMSYMDIFSETS1 jnz .LMSYMDIFSETS1
end; end;
end; end;
{ compares set1 and set2 } procedure comp_sets(set1,set2 : pointer);[public,alias: 'SET_COMP_SETS'];
{ zeroflag is set if they are equal } {
procedure comp_sets(set1,set2 : pointer);[public,alias: 'SET_COMP_SETS']; compares set1 and set2 zeroflag is set if they are equal
}
begin begin
asm asm
movl 8(%ebp),%esi movl 8(%ebp),%esi
movl 12(%ebp),%edi movl 12(%ebp),%edi
@ -186,20 +191,22 @@
addl $4,%edi addl $4,%edi
decl %ecx decl %ecx
jnz .LMCOMPSETS1 jnz .LMCOMPSETS1
// we are here only if the two sets are equal { we are here only if the two sets are equal
// we have zero flag set, and that what is expected we have zero flag set, and that what is expected }
cmpl %eax,%eax cmpl %eax,%eax
.LMCOMPSETEND: .LMCOMPSETEND:
end; end;
end; end;
{ sets the element b in set p }
{ works for sets larger than 256 elements }
{ not yet use by the compiler so }
{$ifdef ver_above without the number }
procedure do_set(p : pointer;b : word);[public,alias: 'SET_SET_WORD'];
begin {$ifdef LARGESETS}
procedure do_set(p : pointer;b : word);[public,alias: 'SET_SET_WORD'];
{
sets the element b in set p works for sets larger than 256 elements
not yet use by the compiler so
}
begin
asm asm
pushl %eax pushl %eax
movl 8(%ebp),%edi movl 8(%ebp),%edi
@ -212,15 +219,15 @@
btsl %eax,(%edi) btsl %eax,(%edi)
popl %eax popl %eax
end; end;
end; end;
{ tests if the element b is in the set p }
{ the carryflag is set if it present }
{ works for sets larger than 256 elements }
procedure do_in(p : pointer;b : word);[public,alias: 'SET_IN_WORD']; procedure do_in(p : pointer;b : word);[public,alias: 'SET_IN_WORD'];
{
begin tests if the element b is in the set p the carryflag is set if it present
works for sets larger than 256 elements
}
begin
asm asm
pushl %eax pushl %eax
movl 8(%ebp),%edi movl 8(%ebp),%edi
@ -233,15 +240,15 @@
btl %eax,(%edi) btl %eax,(%edi)
popl %eax popl %eax
end; end;
end; end;
{ adds set1 and set2 into set dest }
{ size is the number of bytes in the set }
procedure add_sets(set1,set2,dest : pointer;size : longint); procedure add_sets(set1,set2,dest : pointer;size : longint);[public,alias: 'SET_ADD_SETS_SIZE'];
[public,alias: 'SET_ADD_SETS_SIZE']; {
adds set1 and set2 into set dest size is the number of bytes in the set
}
begin begin
asm asm
movl 8(%ebp),%esi movl 8(%ebp),%esi
movl 12(%ebp),%ebx movl 12(%ebp),%ebx
@ -255,16 +262,15 @@
decl %ecx decl %ecx
jnz .LMADDSETSIZES1 jnz .LMADDSETSIZES1
end; end;
end; end;
{ multiplies (i.E. takes common elements of) set1 and set2 }
{ result put in dest }
{ size is the number of bytes in the set }
procedure mul_sets(set1,set2,dest : pointer;size : longint); procedure mul_sets(set1,set2,dest : pointer;size : longint);[public,alias: 'SET_MUL_SETS_SIZE'];
[public,alias: 'SET_MUL_SETS_SIZE']; {
multiplies (i.E. takes common elements of) set1 and set2 result put in
begin dest size is the number of bytes in the set
}
begin
asm asm
movl 8(%ebp),%esi movl 8(%ebp),%esi
movl 12(%ebp),%ebx movl 12(%ebp),%ebx
@ -278,12 +284,11 @@
decl %ecx decl %ecx
jnz .LMMULSETSIZES1 jnz .LMMULSETSIZES1
end; end;
end; end;
procedure sub_sets(set1,set2,dest : pointer;size : longint);[public,alias: 'SET_SUB_SETS_SIZE']; procedure sub_sets(set1,set2,dest : pointer;size : longint);[public,alias: 'SET_SUB_SETS_SIZE'];
begin
begin
asm asm
movl 8(%ebp),%esi movl 8(%ebp),%esi
movl 12(%ebp),%ebx movl 12(%ebp),%ebx
@ -299,14 +304,14 @@
decl %ecx decl %ecx
jnz .LMSUBSETSIZES1 jnz .LMSUBSETSIZES1
end; end;
end; end;
{ computes the symetric diff from set1 to set2 }
{ result in dest }
procedure sym_sub_sets(set1,set2,dest : pointer;size : longint);[public,alias: 'SET_SYMDIF_SETS_SIZE']; procedure sym_sub_sets(set1,set2,dest : pointer;size : longint);[public,alias: 'SET_SYMDIF_SETS_SIZE'];
{
begin computes the symetric diff from set1 to set2 result in dest
}
begin
asm asm
movl 8(%ebp),%esi movl 8(%ebp),%esi
movl 12(%ebp),%ebx movl 12(%ebp),%ebx
@ -321,12 +326,11 @@
decl %ecx decl %ecx
jnz .LMSYMDIFSETSIZE1 jnz .LMSYMDIFSETSIZE1
end; end;
end; end;
procedure comp_sets(set1,set2 : pointer;size : longint);[public,alias: 'SET_COMP_SETS_SIZE']; procedure comp_sets(set1,set2 : pointer;size : longint);[public,alias: 'SET_COMP_SETS_SIZE'];
begin
begin
asm asm
movl 8(%ebp),%esi movl 8(%ebp),%esi
movl 12(%ebp),%edi movl 12(%ebp),%edi
@ -339,51 +343,18 @@
addl $4,%edi addl $4,%edi
decl %ecx decl %ecx
jnz .LMCOMPSETSIZES1 jnz .LMCOMPSETSIZES1
// we are here only if the two sets are equal { we are here only if the two sets are equal
// we have zero flag set, and that what is expected we have zero flag set, and that what is expected }
cmpl %eax,%eax cmpl %eax,%eax
.LMCOMPSETSIZEEND: .LMCOMPSETSIZEEND:
end; end;
end; end;
{$endif ver_above without the number } {$endif LARGESET}
{ {
$Log$ $Log$
Revision 1.1 1998-03-25 11:18:42 root Revision 1.2 1998-05-31 14:15:51 peter
Initial revision * force to use ATT or direct parsing
Revision 1.7 1998/03/03 12:07:11 florian
* undid the change of some procedures to plain assembler procedures
Revision 1.6 1998/03/02 23:10:33 florian
* SET_* are now assembler procedures
Revision 1.5 1998/02/11 18:37:01 florian
* stupid typing mistake fixed (I though it compiles, but the assembler
wrote an error message)
Revision 1.4 1998/02/11 16:17:45 florian
+ helper routine for "dynamic" set constructors with ranges added
Revision 1.3 1998/01/26 11:59:09 michael
+ Added log at the end
Working file: rtl/i386/set.inc
description:
----------------------------
revision 1.2
date: 1997/12/01 12:34:37; author: michael; state: Exp; lines: +11 -4
+ added copyright reference in header.
----------------------------
revision 1.1
date: 1997/11/27 08:33:48; author: michael; state: Exp;
Initial revision
----------------------------
revision 1.1.1.1
date: 1997/11/27 08:33:48; author: michael; state: Exp; lines: +0 -0
FPC RTL CVS start
=============================================================================
} }

View File

@ -233,6 +233,7 @@ implementation
end ['EDI','ESI','EBX','EAX','ECX']; end ['EDI','ESI','EBX','EAX','ECX'];
end; end;
{$ASMMODE DIRECT}
function strpas(p : pchar) : string; function strpas(p : pchar) : string;
begin begin
asm asm
@ -268,6 +269,7 @@ implementation
movsb movsb
end ['ECX','EAX','ESI','EDI']; end ['ECX','EAX','ESI','EDI'];
end; end;
{$ASMMODE ATT}
function strcat(dest,source : pchar) : pchar; function strcat(dest,source : pchar) : pchar;
@ -587,7 +589,10 @@ end.
{ {
$Log$ $Log$
Revision 1.3 1998-05-30 14:30:22 peter Revision 1.4 1998-05-31 14:15:52 peter
* force to use ATT or direct parsing
Revision 1.3 1998/05/30 14:30:22 peter
* force att reading * force att reading
Revision 1.2 1998/05/23 01:14:06 peter Revision 1.2 1998/05/23 01:14:06 peter