mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 02:09:43 +02:00
* reorganize Tcgx86.g_concatcopy
This commit is contained in:
parent
b826ad8b7e
commit
e29d1ecda9
@ -2759,14 +2759,14 @@ unit cgx86;
|
|||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
type
|
type
|
||||||
copymode=(copy_move,copy_mmx,copy_string,copy_mm,copy_avx,copy_avx512);
|
tcopymode=(copy_mov,copy_mmx,copy_string,copy_mm,copy_avx,copy_avx512,copy_fpc_move);
|
||||||
|
|
||||||
var srcref,dstref,tmpref:Treference;
|
var srcref,dstref,tmpref:Treference;
|
||||||
r,r0,r1,r2,r3:Tregister;
|
r,r0,r1,r2,r3:Tregister;
|
||||||
helpsize:tcgint;
|
helpsize:tcgint;
|
||||||
copysize:byte;
|
copysize:byte;
|
||||||
cgsize:Tcgsize;
|
cgsize:Tcgsize;
|
||||||
cm:copymode;
|
cm:tcopymode;
|
||||||
saved_ds,saved_es: Boolean;
|
saved_ds,saved_es: Boolean;
|
||||||
hlist: TAsmList;
|
hlist: TAsmList;
|
||||||
|
|
||||||
@ -2813,7 +2813,7 @@ unit cgx86;
|
|||||||
dstref.base:=r;
|
dstref.base:=r;
|
||||||
end;
|
end;
|
||||||
{$endif x86_64}
|
{$endif x86_64}
|
||||||
cm:=copy_move;
|
cm:=copy_mov;
|
||||||
helpsize:=3*sizeof(aword);
|
helpsize:=3*sizeof(aword);
|
||||||
if cs_opt_size in current_settings.optimizerswitches then
|
if cs_opt_size in current_settings.optimizerswitches then
|
||||||
helpsize:=2*sizeof(aword);
|
helpsize:=2*sizeof(aword);
|
||||||
@ -2848,6 +2848,12 @@ unit cgx86;
|
|||||||
else
|
else
|
||||||
if len>helpsize then
|
if len>helpsize then
|
||||||
cm:=copy_string;
|
cm:=copy_string;
|
||||||
|
|
||||||
|
if (cm=copy_string) and not(CPUX86_HINT_FAST_SHORT_REP_MOVS in cpu_optimization_hints[current_settings.optimizecputype]) and
|
||||||
|
{ we can use the move variant only if the subroutine does another call }
|
||||||
|
(pi_do_call in current_procinfo.flags) then
|
||||||
|
cm:=copy_fpc_move;
|
||||||
|
|
||||||
if (cs_opt_size in current_settings.optimizerswitches) and
|
if (cs_opt_size in current_settings.optimizerswitches) and
|
||||||
not((len<=16) and (cm in [copy_mmx,copy_mm,copy_avx])) and
|
not((len<=16) and (cm in [copy_mmx,copy_mm,copy_avx])) and
|
||||||
not(len in copy_len_sizes) then
|
not(len in copy_len_sizes) then
|
||||||
@ -2859,7 +2865,7 @@ unit cgx86;
|
|||||||
cm:=copy_string;
|
cm:=copy_string;
|
||||||
{$endif not i8086}
|
{$endif not i8086}
|
||||||
case cm of
|
case cm of
|
||||||
copy_move:
|
copy_mov:
|
||||||
begin
|
begin
|
||||||
copysize:=sizeof(aint);
|
copysize:=sizeof(aint);
|
||||||
cgsize:=int_cgsize(copysize);
|
cgsize:=int_cgsize(copysize);
|
||||||
@ -3047,11 +3053,9 @@ unit cgx86;
|
|||||||
end;
|
end;
|
||||||
list.concatList(hlist);
|
list.concatList(hlist);
|
||||||
hlist.free;
|
hlist.free;
|
||||||
end
|
end;
|
||||||
else if (CPUX86_HINT_FAST_SHORT_REP_MOVS in cpu_optimization_hints[current_settings.optimizecputype]) or
|
|
||||||
{ we can use the move variant only if the subroutine does another call }
|
copy_string:
|
||||||
not(pi_do_call in current_procinfo.flags) then
|
|
||||||
{ copy_string, should be a good fallback in case of unhandled if short rep movs are fast }
|
|
||||||
begin
|
begin
|
||||||
getcpuregister(list,REGDI);
|
getcpuregister(list,REGDI);
|
||||||
if (dstref.segment=NR_NO) and
|
if (dstref.segment=NR_NO) and
|
||||||
|
Loading…
Reference in New Issue
Block a user