mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-10 00:27:21 +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 cpumm}
|
||||
{$define fewintregisters}
|
||||
{//$define cpurox}
|
||||
{$define cpurox}
|
||||
{$define cpurefshaveindexreg}
|
||||
{$define SUPPORT_SAFECALL}
|
||||
{$define cpuneedsmulhelper}
|
||||
|
||||
@ -257,7 +257,7 @@ unit cgcpu;
|
||||
tmpreg: tregister;
|
||||
op1, op2: TAsmOp;
|
||||
ax_subreg: tregister;
|
||||
hl_loop_start: tasmlabel;
|
||||
hl_loop_start,hl_skip: tasmlabel;
|
||||
ai: taicpu;
|
||||
use_loop, use_186_fast_shift, use_8086_fast_shift,
|
||||
use_386_fast_shift: Boolean;
|
||||
@ -562,6 +562,61 @@ unit cgcpu;
|
||||
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
|
||||
begin
|
||||
tmpreg:=getintregister(list,size);
|
||||
|
||||
@ -1047,8 +1047,13 @@ implementation
|
||||
tshlshrnode(left).left.isequal(tshlshrnode(right).left) and
|
||||
not(might_have_sideeffects(tshlshrnode(left).left)) then
|
||||
begin
|
||||
if tordconstnode(tshlshrnode(left).right).value=
|
||||
tshlshrnode(left).left.resultdef.size*8-tordconstnode(tshlshrnode(right).right).value then
|
||||
if (tordconstnode(tshlshrnode(left).right).value=
|
||||
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
|
||||
result:=cinlinenode.create(in_ror_x_y,false,
|
||||
ccallparanode.create(tshlshrnode(left).right,
|
||||
@ -1057,8 +1062,13 @@ implementation
|
||||
tshlshrnode(left).right:=nil;
|
||||
exit;
|
||||
end
|
||||
else if tordconstnode(tshlshrnode(right).right).value=
|
||||
tshlshrnode(left).left.resultdef.size*8-tordconstnode(tshlshrnode(left).right).value then
|
||||
else if (tordconstnode(tshlshrnode(right).right).value=
|
||||
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
|
||||
result:=cinlinenode.create(in_rol_x_y,false,
|
||||
ccallparanode.create(tshlshrnode(right).right,
|
||||
@ -1076,8 +1086,13 @@ implementation
|
||||
tshlshrnode(left).left.isequal(tshlshrnode(right).left) and
|
||||
not(might_have_sideeffects(tshlshrnode(left).left)) then
|
||||
begin
|
||||
if tordconstnode(tshlshrnode(left).right).value=
|
||||
tshlshrnode(left).left.resultdef.size*8-tordconstnode(tshlshrnode(right).right).value then
|
||||
if (tordconstnode(tshlshrnode(left).right).value=
|
||||
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
|
||||
result:=cinlinenode.create(in_rol_x_y,false,
|
||||
ccallparanode.create(tshlshrnode(left).right,
|
||||
@ -1086,8 +1101,13 @@ implementation
|
||||
tshlshrnode(left).right:=nil;
|
||||
exit;
|
||||
end
|
||||
else if tordconstnode(tshlshrnode(right).right).value=
|
||||
tshlshrnode(left).left.resultdef.size*8-tordconstnode(tshlshrnode(left).right).value then
|
||||
else if (tordconstnode(tshlshrnode(right).right).value=
|
||||
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
|
||||
result:=cinlinenode.create(in_ror_x_y,false,
|
||||
ccallparanode.create(tshlshrnode(right).right,
|
||||
|
||||
@ -904,10 +904,10 @@ function NtoLE(const AValue: QWord): QWord;{$ifdef SYSTEMINLINE}inline;{$endif}
|
||||
|
||||
{$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_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)}
|
||||
{$define FPC_HAS_INTERNAL_ROX_DWORD}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user