summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornickysn <nickysn@3ad0048d-3df7-0310-abae-a5850022a9f2>2020-04-26 22:09:37 +0000
committernickysn <nickysn@3ad0048d-3df7-0310-abae-a5850022a9f2>2020-04-26 22:09:37 +0000
commitf7c0a2d9b8013df1e61555a87bf762db0dc01532 (patch)
tree992e54b019129fef726543fdae28400c46799c09
parent6006afcd257f7933d207e9992fce27f883e23505 (diff)
downloadfpc-f7c0a2d9b8013df1e61555a87bf762db0dc01532.tar.gz
* handle nf_swapped properly in TZ80AddNode.second_cmp16_32_64bit
git-svn-id: https://svn.freepascal.org/svn/fpc/branches/z80@45128 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r--compiler/z80/nz80add.pas37
1 files changed, 28 insertions, 9 deletions
diff --git a/compiler/z80/nz80add.pas b/compiler/z80/nz80add.pas
index b05fda01a6..ea2808d927 100644
--- a/compiler/z80/nz80add.pas
+++ b/compiler/z80/nz80add.pas
@@ -332,6 +332,7 @@ interface
i, size: Integer;
tmpref: treference;
op: TAsmOp;
+ actualnodetype: tnodetype;
begin
truelabel:=nil;
falselabel:=nil;
@@ -437,6 +438,24 @@ interface
end
else
begin
+ if nf_swapped in Flags then
+ begin
+ case NodeType of
+ ltn:
+ actualnodetype:=gtn;
+ lten:
+ actualnodetype:=gten;
+ gtn:
+ actualnodetype:=ltn;
+ gten:
+ actualnodetype:=lten;
+ else
+ internalerror(2020042701);
+ end;
+ end
+ else
+ actualnodetype:=NodeType;
+
if left.location.loc<>LOC_REGISTER then
hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,left.resultdef,false);
@@ -456,7 +475,7 @@ interface
op:=A_CP;
current_asmdata.CurrAsmList.Concat(taicpu.op_reg_ref(op,NR_A,tmpref));
if (i=(size-1)) and (not unsigned) then
- case NodeType of
+ case actualnodetype of
ltn,
lten:
tcgz80(cg).a_jmp_signed_cmp_3way(current_asmdata.CurrAsmList,truelabel,nil,falselabel);
@@ -467,7 +486,7 @@ interface
internalerror(2020042202);
end
else if i<>0 then
- case NodeType of
+ case actualnodetype of
ltn,
lten:
tcgz80(cg).a_jmp_unsigned_cmp_3way(current_asmdata.CurrAsmList,truelabel,nil,falselabel);
@@ -478,7 +497,7 @@ interface
internalerror(2020042202);
end
else
- case NodeType of
+ case actualnodetype of
ltn:
tcgz80(cg).a_jmp_unsigned_cmp_3way(current_asmdata.CurrAsmList,truelabel,falselabel,falselabel);
lten:
@@ -511,7 +530,7 @@ interface
op:=A_CP;
current_asmdata.CurrAsmList.Concat(taicpu.op_reg_const(op,NR_A,byte(right.location.value shr (i*8))));
if (i=(size-1)) and (not unsigned) then
- case NodeType of
+ case actualnodetype of
ltn,
lten:
tcgz80(cg).a_jmp_signed_cmp_3way(current_asmdata.CurrAsmList,truelabel,nil,falselabel);
@@ -522,7 +541,7 @@ interface
internalerror(2020042202);
end
else if i<>0 then
- case NodeType of
+ case actualnodetype of
ltn,
lten:
tcgz80(cg).a_jmp_unsigned_cmp_3way(current_asmdata.CurrAsmList,truelabel,nil,falselabel);
@@ -533,7 +552,7 @@ interface
internalerror(2020042202);
end
else
- case NodeType of
+ case actualnodetype of
ltn:
tcgz80(cg).a_jmp_unsigned_cmp_3way(current_asmdata.CurrAsmList,truelabel,falselabel,falselabel);
lten:
@@ -560,7 +579,7 @@ interface
op:=A_CP;
current_asmdata.CurrAsmList.Concat(taicpu.op_reg_reg(op,NR_A,tcgz80(cg).GetOffsetReg64(right.location.register,right.location.registerhi,i)));
if (i=(size-1)) and (not unsigned) then
- case NodeType of
+ case actualnodetype of
ltn,
lten:
tcgz80(cg).a_jmp_signed_cmp_3way(current_asmdata.CurrAsmList,truelabel,nil,falselabel);
@@ -571,7 +590,7 @@ interface
internalerror(2020042202);
end
else if i<>0 then
- case NodeType of
+ case actualnodetype of
ltn,
lten:
tcgz80(cg).a_jmp_unsigned_cmp_3way(current_asmdata.CurrAsmList,truelabel,nil,falselabel);
@@ -582,7 +601,7 @@ interface
internalerror(2020042202);
end
else
- case NodeType of
+ case actualnodetype of
ltn:
tcgz80(cg).a_jmp_unsigned_cmp_3way(current_asmdata.CurrAsmList,truelabel,falselabel,falselabel);
lten: