+ added a new x86-specific compiler option 'enablecld', which controls whether

the compiler should emit a CLD before using the x86 string instructions.

git-svn-id: trunk@25590 -
This commit is contained in:
nickysn 2013-09-28 11:54:02 +00:00
parent 4d1fb1573e
commit 52fcc0a407
5 changed files with 23 additions and 5 deletions

View File

@ -154,6 +154,12 @@ interface
disabledircache : boolean;
{$if defined(x86)}
{ setting this to true causes the compiler to emit a CLD instruction
before using the x86 string instructions. }
enablecld : boolean;
{$endif defined(x86)}
{$if defined(i8086)}
x86memorymodel : tx86memorymodel;
{$endif defined(i8086)}
@ -485,6 +491,13 @@ interface
minfpconstprec : s32real;
disabledircache : false;
{$if defined(i8086)}
enablecld : true;
{$elseif defined(i386)}
enablecld : true;
{$elseif defined(x86_64)}
enablecld : false;
{$endif}
{$if defined(i8086)}
x86memorymodel : mm_small;
{$endif defined(i8086)}

View File

@ -485,7 +485,8 @@ unit cgcpu;
else
list.concat(Taicpu.op_const_reg(A_IMUL,S_L,len,NR_ECX));
end;
list.concat(Taicpu.op_none(A_CLD,S_NO));
if current_settings.enablecld then
list.concat(Taicpu.op_none(A_CLD,S_NO));
list.concat(Taicpu.op_none(A_REP,S_NO));
case opsize of
S_B : list.concat(Taicpu.Op_none(A_MOVSB,S_NO));

View File

@ -1504,7 +1504,8 @@ unit cgcpu;
else
list.concat(Taicpu.op_const_reg(A_IMUL,S_W,len,NR_CX));
end;
list.concat(Taicpu.op_none(A_CLD,S_NO));
if current_settings.enablecld then
list.concat(Taicpu.op_none(A_CLD,S_NO));
list.concat(Taicpu.op_none(A_REP,S_NO));
case opsize of
S_B : list.concat(Taicpu.Op_none(A_MOVSB,S_NO));

View File

@ -3475,6 +3475,10 @@ if (target_info.abi = abi_eabihf) then
mm_huge: def_system_macro('FPC_MM_HUGE');
end;
{$endif}
{$if defined(x86)}
if current_settings.enablecld then
def_system_macro('FPC_ENABLED_CLD');
{$endif}
{ Section smartlinking conflicts with import sections on Windows }

View File

@ -2233,9 +2233,8 @@ unit cgx86;
end;
getcpuregister(list,REGCX);
{$if defined(i8086) or defined(i386)}
list.concat(Taicpu.op_none(A_CLD,S_NO));
{$endif i8086 or i386}
if current_settings.enablecld then
list.concat(Taicpu.op_none(A_CLD,S_NO));
if (cs_opt_size in current_settings.optimizerswitches) and
(len>sizeof(aint)+(sizeof(aint) div 2)) then
begin