mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-10 18:21:04 +01:00
+ enabled the rol/ror intrinsic on i8086
git-svn-id: trunk@35734 -
This commit is contained in:
parent
0b1a54f924
commit
321876252b
@ -50,7 +50,7 @@
|
|||||||
{//$define SUPPORT_MMX}
|
{//$define SUPPORT_MMX}
|
||||||
{$define cpumm}
|
{$define cpumm}
|
||||||
{$define fewintregisters}
|
{$define fewintregisters}
|
||||||
{//$define cpurox}
|
{$define cpurox}
|
||||||
{$define cpurefshaveindexreg}
|
{$define cpurefshaveindexreg}
|
||||||
{$define SUPPORT_SAFECALL}
|
{$define SUPPORT_SAFECALL}
|
||||||
{$define cpuneedsmulhelper}
|
{$define cpuneedsmulhelper}
|
||||||
|
|||||||
@ -257,7 +257,7 @@ unit cgcpu;
|
|||||||
tmpreg: tregister;
|
tmpreg: tregister;
|
||||||
op1, op2: TAsmOp;
|
op1, op2: TAsmOp;
|
||||||
ax_subreg: tregister;
|
ax_subreg: tregister;
|
||||||
hl_loop_start: tasmlabel;
|
hl_loop_start,hl_skip: tasmlabel;
|
||||||
ai: taicpu;
|
ai: taicpu;
|
||||||
use_loop, use_186_fast_shift, use_8086_fast_shift,
|
use_loop, use_186_fast_shift, use_8086_fast_shift,
|
||||||
use_386_fast_shift: Boolean;
|
use_386_fast_shift: Boolean;
|
||||||
@ -562,6 +562,61 @@ unit cgcpu;
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
OP_ROL,OP_ROR:
|
||||||
|
begin
|
||||||
|
a:=a and 31;
|
||||||
|
if a=16 then
|
||||||
|
list.Concat(taicpu.op_reg_reg(A_XCHG,S_W,reg,GetNextReg(reg)))
|
||||||
|
else if ((a=1) and (op=OP_ROL)) or ((a=31) and (op=OP_ROR)) then
|
||||||
|
begin
|
||||||
|
list.Concat(taicpu.op_const_reg(A_SHL,S_W,1,GetNextReg(reg)));
|
||||||
|
list.Concat(taicpu.op_const_reg(A_RCL,S_W,1,reg));
|
||||||
|
list.Concat(taicpu.op_const_reg(A_ADC,S_W,0,GetNextReg(reg)));
|
||||||
|
end
|
||||||
|
else if ((a=15) and (op=OP_ROL)) or ((a=31) and (op=OP_ROR)) then
|
||||||
|
begin
|
||||||
|
list.Concat(taicpu.op_reg_reg(A_XCHG,S_W,reg,GetNextReg(reg)));
|
||||||
|
|
||||||
|
list.Concat(taicpu.op_const_reg(A_SHR,S_W,1,reg));
|
||||||
|
list.Concat(taicpu.op_const_reg(A_RCR,S_W,1,GetNextReg(reg)));
|
||||||
|
|
||||||
|
current_asmdata.getjumplabel(hl_skip);
|
||||||
|
|
||||||
|
ai:=Taicpu.Op_Sym(A_Jcc,S_NO,hl_skip);
|
||||||
|
ai.SetCondition(C_NC);
|
||||||
|
ai.is_jmp:=true;
|
||||||
|
list.concat(ai);
|
||||||
|
|
||||||
|
list.Concat(taicpu.op_const_reg(A_ADD,S_W,aint($8000),reg));
|
||||||
|
|
||||||
|
a_label(list,hl_skip);
|
||||||
|
end
|
||||||
|
else if ((a=17) and (op=OP_ROL)) or ((a=31) and (op=OP_ROR)) then
|
||||||
|
begin
|
||||||
|
list.Concat(taicpu.op_reg_reg(A_XCHG,S_W,reg,GetNextReg(reg)));
|
||||||
|
list.Concat(taicpu.op_const_reg(A_SHL,S_W,1,GetNextReg(reg)));
|
||||||
|
list.Concat(taicpu.op_const_reg(A_RCL,S_W,1,reg));
|
||||||
|
list.Concat(taicpu.op_const_reg(A_ADC,S_W,0,GetNextReg(reg)));
|
||||||
|
end
|
||||||
|
else if ((a=31) and (op=OP_ROL)) or ((a=1) and (op=OP_ROR)) then
|
||||||
|
begin
|
||||||
|
list.Concat(taicpu.op_const_reg(A_SHR,S_W,1,reg));
|
||||||
|
list.Concat(taicpu.op_const_reg(A_RCR,S_W,1,GetNextReg(reg)));
|
||||||
|
|
||||||
|
current_asmdata.getjumplabel(hl_skip);
|
||||||
|
|
||||||
|
ai:=Taicpu.Op_Sym(A_Jcc,S_NO,hl_skip);
|
||||||
|
ai.SetCondition(C_NC);
|
||||||
|
ai.is_jmp:=true;
|
||||||
|
list.concat(ai);
|
||||||
|
|
||||||
|
list.Concat(taicpu.op_const_reg(A_ADD,S_W,aint($8000),reg));
|
||||||
|
|
||||||
|
a_label(list,hl_skip);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
internalerror(2017040501);
|
||||||
|
end;
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
tmpreg:=getintregister(list,size);
|
tmpreg:=getintregister(list,size);
|
||||||
|
|||||||
@ -1047,8 +1047,13 @@ implementation
|
|||||||
tshlshrnode(left).left.isequal(tshlshrnode(right).left) and
|
tshlshrnode(left).left.isequal(tshlshrnode(right).left) and
|
||||||
not(might_have_sideeffects(tshlshrnode(left).left)) then
|
not(might_have_sideeffects(tshlshrnode(left).left)) then
|
||||||
begin
|
begin
|
||||||
if tordconstnode(tshlshrnode(left).right).value=
|
if (tordconstnode(tshlshrnode(left).right).value=
|
||||||
tshlshrnode(left).left.resultdef.size*8-tordconstnode(tshlshrnode(right).right).value then
|
tshlshrnode(left).left.resultdef.size*8-tordconstnode(tshlshrnode(right).right).value)
|
||||||
|
{$ifdef i8086}
|
||||||
|
and (not(torddef(left.resultdef).ordtype in [s32bit,u32bit]) or
|
||||||
|
(tordconstnode(tshlshrnode(left).right).value.svalue in [1,15,16,17,31]))
|
||||||
|
{$endif i8086}
|
||||||
|
then
|
||||||
begin
|
begin
|
||||||
result:=cinlinenode.create(in_ror_x_y,false,
|
result:=cinlinenode.create(in_ror_x_y,false,
|
||||||
ccallparanode.create(tshlshrnode(left).right,
|
ccallparanode.create(tshlshrnode(left).right,
|
||||||
@ -1057,8 +1062,13 @@ implementation
|
|||||||
tshlshrnode(left).right:=nil;
|
tshlshrnode(left).right:=nil;
|
||||||
exit;
|
exit;
|
||||||
end
|
end
|
||||||
else if tordconstnode(tshlshrnode(right).right).value=
|
else if (tordconstnode(tshlshrnode(right).right).value=
|
||||||
tshlshrnode(left).left.resultdef.size*8-tordconstnode(tshlshrnode(left).right).value then
|
tshlshrnode(left).left.resultdef.size*8-tordconstnode(tshlshrnode(left).right).value)
|
||||||
|
{$ifdef i8086}
|
||||||
|
and (not(torddef(left.resultdef).ordtype in [s32bit,u32bit]) or
|
||||||
|
(tordconstnode(tshlshrnode(right).right).value.svalue in [1,15,16,17,31]))
|
||||||
|
{$endif i8086}
|
||||||
|
then
|
||||||
begin
|
begin
|
||||||
result:=cinlinenode.create(in_rol_x_y,false,
|
result:=cinlinenode.create(in_rol_x_y,false,
|
||||||
ccallparanode.create(tshlshrnode(right).right,
|
ccallparanode.create(tshlshrnode(right).right,
|
||||||
@ -1076,8 +1086,13 @@ implementation
|
|||||||
tshlshrnode(left).left.isequal(tshlshrnode(right).left) and
|
tshlshrnode(left).left.isequal(tshlshrnode(right).left) and
|
||||||
not(might_have_sideeffects(tshlshrnode(left).left)) then
|
not(might_have_sideeffects(tshlshrnode(left).left)) then
|
||||||
begin
|
begin
|
||||||
if tordconstnode(tshlshrnode(left).right).value=
|
if (tordconstnode(tshlshrnode(left).right).value=
|
||||||
tshlshrnode(left).left.resultdef.size*8-tordconstnode(tshlshrnode(right).right).value then
|
tshlshrnode(left).left.resultdef.size*8-tordconstnode(tshlshrnode(right).right).value)
|
||||||
|
{$ifdef i8086}
|
||||||
|
and (not(torddef(left.resultdef).ordtype in [s32bit,u32bit]) or
|
||||||
|
(tordconstnode(tshlshrnode(left).right).value.svalue in [1,15,16,17,31]))
|
||||||
|
{$endif i8086}
|
||||||
|
then
|
||||||
begin
|
begin
|
||||||
result:=cinlinenode.create(in_rol_x_y,false,
|
result:=cinlinenode.create(in_rol_x_y,false,
|
||||||
ccallparanode.create(tshlshrnode(left).right,
|
ccallparanode.create(tshlshrnode(left).right,
|
||||||
@ -1086,8 +1101,13 @@ implementation
|
|||||||
tshlshrnode(left).right:=nil;
|
tshlshrnode(left).right:=nil;
|
||||||
exit;
|
exit;
|
||||||
end
|
end
|
||||||
else if tordconstnode(tshlshrnode(right).right).value=
|
else if (tordconstnode(tshlshrnode(right).right).value=
|
||||||
tshlshrnode(left).left.resultdef.size*8-tordconstnode(tshlshrnode(left).right).value then
|
tshlshrnode(left).left.resultdef.size*8-tordconstnode(tshlshrnode(left).right).value)
|
||||||
|
{$ifdef i8086}
|
||||||
|
and (not(torddef(left.resultdef).ordtype in [s32bit,u32bit]) or
|
||||||
|
(tordconstnode(tshlshrnode(right).right).value.svalue in [1,15,16,17,31]))
|
||||||
|
{$endif i8086}
|
||||||
|
then
|
||||||
begin
|
begin
|
||||||
result:=cinlinenode.create(in_ror_x_y,false,
|
result:=cinlinenode.create(in_ror_x_y,false,
|
||||||
ccallparanode.create(tshlshrnode(right).right,
|
ccallparanode.create(tshlshrnode(right).right,
|
||||||
|
|||||||
@ -904,10 +904,10 @@ function NtoLE(const AValue: QWord): QWord;{$ifdef SYSTEMINLINE}inline;{$endif}
|
|||||||
|
|
||||||
{$ifdef FPC_HAS_INTERNAL_ROX}
|
{$ifdef FPC_HAS_INTERNAL_ROX}
|
||||||
|
|
||||||
{$if defined(cpux86_64) or defined(cpui386)}
|
{$if defined(cpux86_64) or defined(cpui386) or defined(cpui8086)}
|
||||||
{$define FPC_HAS_INTERNAL_ROX_BYTE}
|
{$define FPC_HAS_INTERNAL_ROX_BYTE}
|
||||||
{$define FPC_HAS_INTERNAL_ROX_WORD}
|
{$define FPC_HAS_INTERNAL_ROX_WORD}
|
||||||
{$endif defined(cpux86_64) or defined(cpui386)}
|
{$endif defined(cpux86_64) or defined(cpui386) or defined(cpui8086)}
|
||||||
|
|
||||||
{$if defined(cpux86_64) or defined(cpui386) or defined(arm) or defined(powerpc) or defined(powerpc64) or defined(cpuaarch64)}
|
{$if defined(cpux86_64) or defined(cpui386) or defined(arm) or defined(powerpc) or defined(powerpc64) or defined(cpuaarch64)}
|
||||||
{$define FPC_HAS_INTERNAL_ROX_DWORD}
|
{$define FPC_HAS_INTERNAL_ROX_DWORD}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user