mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-13 11:09:13 +02:00
+ implemented 8-bit signed comparisons as well
git-svn-id: branches/z80@44583 -
This commit is contained in:
parent
8a1be73ce0
commit
fdc24164a0
@ -74,9 +74,9 @@ interface
|
|||||||
ltn:
|
ltn:
|
||||||
GetResFlags:=F_NotPossible;
|
GetResFlags:=F_NotPossible;
|
||||||
lten:
|
lten:
|
||||||
GetResFlags:=F_NotPossible;
|
GetResFlags:=F_P;
|
||||||
gtn:
|
gtn:
|
||||||
GetResFlags:=F_NotPossible;
|
GetResFlags:=F_M;
|
||||||
gten:
|
gten:
|
||||||
GetResFlags:=F_NotPossible;
|
GetResFlags:=F_NotPossible;
|
||||||
else
|
else
|
||||||
@ -85,13 +85,13 @@ interface
|
|||||||
else
|
else
|
||||||
case NodeType of
|
case NodeType of
|
||||||
ltn:
|
ltn:
|
||||||
GetResFlags:=F_NotPossible;
|
GetResFlags:=F_M;
|
||||||
lten:
|
lten:
|
||||||
GetResFlags:=F_NotPossible;
|
GetResFlags:=F_NotPossible;
|
||||||
gtn:
|
gtn:
|
||||||
GetResFlags:=F_NotPossible;
|
GetResFlags:=F_NotPossible;
|
||||||
gten:
|
gten:
|
||||||
GetResFlags:=F_NotPossible;
|
GetResFlags:=F_P;
|
||||||
else
|
else
|
||||||
internalerror(2014082021);
|
internalerror(2014082021);
|
||||||
end;
|
end;
|
||||||
@ -190,6 +190,8 @@ interface
|
|||||||
i : longint;
|
i : longint;
|
||||||
opdef: tdef;
|
opdef: tdef;
|
||||||
opsize: TCgSize;
|
opsize: TCgSize;
|
||||||
|
ai: taicpu;
|
||||||
|
l: TAsmLabel;
|
||||||
begin
|
begin
|
||||||
unsigned:=not(is_signed(left.resultdef)) or
|
unsigned:=not(is_signed(left.resultdef)) or
|
||||||
not(is_signed(right.resultdef));
|
not(is_signed(right.resultdef));
|
||||||
@ -241,6 +243,56 @@ interface
|
|||||||
internalerror(2020040402);
|
internalerror(2020040402);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
location_reset(location,LOC_FLAGS,OS_NO);
|
||||||
|
location.resflags:=getresflags(unsigned);
|
||||||
|
end
|
||||||
|
else if opsize=OS_S8 then
|
||||||
|
begin
|
||||||
|
if getresflags(unsigned)=F_NotPossible then
|
||||||
|
swapleftright;
|
||||||
|
|
||||||
|
if left.location.loc<>LOC_REGISTER then
|
||||||
|
hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,left.resultdef,false);
|
||||||
|
|
||||||
|
if right.location.loc in [LOC_REFERENCE,LOC_CREFERENCE] then
|
||||||
|
begin
|
||||||
|
if (right.location.reference.base=NR_IX) and (right.location.reference.index=NR_NO) then
|
||||||
|
begin
|
||||||
|
cg.getcpuregister(current_asmdata.CurrAsmList,NR_A);
|
||||||
|
cg.a_load_loc_reg(current_asmdata.CurrAsmList,def_cgsize(left.resultdef),left.location,NR_A);
|
||||||
|
current_asmdata.CurrAsmList.Concat(taicpu.op_reg_ref(A_SUB,NR_A,right.location.reference));
|
||||||
|
end
|
||||||
|
else
|
||||||
|
hlcg.location_force_reg(current_asmdata.CurrAsmList,right.location,right.resultdef,right.resultdef,false);
|
||||||
|
end;
|
||||||
|
case right.location.loc of
|
||||||
|
LOC_CONSTANT:
|
||||||
|
begin
|
||||||
|
cg.getcpuregister(current_asmdata.CurrAsmList,NR_A);
|
||||||
|
cg.a_load_loc_reg(current_asmdata.CurrAsmList,def_cgsize(left.resultdef),left.location,NR_A);
|
||||||
|
current_asmdata.CurrAsmList.Concat(taicpu.op_reg_const(A_SUB,NR_A,right.location.value));
|
||||||
|
end;
|
||||||
|
LOC_REGISTER,LOC_CREGISTER:
|
||||||
|
begin
|
||||||
|
cg.getcpuregister(current_asmdata.CurrAsmList,NR_A);
|
||||||
|
cg.a_load_loc_reg(current_asmdata.CurrAsmList,def_cgsize(left.resultdef),left.location,NR_A);
|
||||||
|
current_asmdata.CurrAsmList.Concat(taicpu.op_reg_reg(A_SUB,NR_A,right.location.register));
|
||||||
|
end;
|
||||||
|
LOC_REFERENCE,LOC_CREFERENCE:
|
||||||
|
begin
|
||||||
|
{ Already handled before the case statement. Nothing to do here. }
|
||||||
|
end;
|
||||||
|
else
|
||||||
|
internalerror(2020040402);
|
||||||
|
end;
|
||||||
|
current_asmdata.getjumplabel(l);
|
||||||
|
ai:=taicpu.op_cond_sym(A_JP,C_PO,l);
|
||||||
|
ai.is_jmp:=true;
|
||||||
|
current_asmdata.CurrAsmList.concat(ai);
|
||||||
|
current_asmdata.CurrAsmList.Concat(taicpu.op_reg_const(A_XOR,NR_A,$80));
|
||||||
|
cg.a_label(current_asmdata.CurrAsmList,l);
|
||||||
|
cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_A);
|
||||||
|
|
||||||
location_reset(location,LOC_FLAGS,OS_NO);
|
location_reset(location,LOC_FLAGS,OS_NO);
|
||||||
location.resflags:=getresflags(unsigned);
|
location.resflags:=getresflags(unsigned);
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user