mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 23:19:24 +02:00
+ a lot missing flag allocs/deallocs added
git-svn-id: trunk@22201 -
This commit is contained in:
parent
2d2c66467c
commit
45383fd32d
@ -715,9 +715,12 @@ unit cgcpu;
|
|||||||
));
|
));
|
||||||
end
|
end
|
||||||
else}
|
else}
|
||||||
list.concat(setoppostfix(
|
begin
|
||||||
taicpu.op_reg_reg_const(op_reg_reg_opcg2asmop[op],dst,src,a),toppostfix(ord(cgsetflags or setflags)*ord(PF_S))
|
if cgsetflags or setflags then
|
||||||
));
|
a_reg_alloc(list,NR_DEFAULTFLAGS);
|
||||||
|
list.concat(setoppostfix(
|
||||||
|
taicpu.op_reg_reg_const(op_reg_reg_opcg2asmop[op],dst,src,a),toppostfix(ord(cgsetflags or setflags)*ord(PF_S))));
|
||||||
|
end;
|
||||||
if (cgsetflags or setflags) and (size in [OS_8,OS_16,OS_32]) then
|
if (cgsetflags or setflags) and (size in [OS_8,OS_16,OS_32]) then
|
||||||
begin
|
begin
|
||||||
ovloc.loc:=LOC_FLAGS;
|
ovloc.loc:=LOC_FLAGS;
|
||||||
@ -888,9 +891,12 @@ unit cgcpu;
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
else
|
else
|
||||||
list.concat(setoppostfix(
|
begin
|
||||||
taicpu.op_reg_reg_reg(op_reg_reg_opcg2asmop[op],dst,src2,src1),toppostfix(ord(cgsetflags or setflags)*ord(PF_S))
|
if cgsetflags or setflags then
|
||||||
));
|
a_reg_alloc(list,NR_DEFAULTFLAGS);
|
||||||
|
list.concat(setoppostfix(
|
||||||
|
taicpu.op_reg_reg_reg(op_reg_reg_opcg2asmop[op],dst,src2,src1),toppostfix(ord(cgsetflags or setflags)*ord(PF_S))));
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
maybeadjustresult(list,op,size,dst);
|
maybeadjustresult(list,op,size,dst);
|
||||||
end;
|
end;
|
||||||
@ -2013,9 +2019,11 @@ unit cgcpu;
|
|||||||
dstref.offset:=size;
|
dstref.offset:=size;
|
||||||
r:=getintregister(list,size2opsize[size]);
|
r:=getintregister(list,size2opsize[size]);
|
||||||
a_load_ref_reg(list,size2opsize[size],size2opsize[size],srcref,r);
|
a_load_ref_reg(list,size2opsize[size],size2opsize[size],srcref,r);
|
||||||
|
a_reg_alloc(list,NR_DEFAULTFLAGS);
|
||||||
list.concat(setoppostfix(taicpu.op_reg_reg_const(A_SUB,countreg,countreg,1),PF_S));
|
list.concat(setoppostfix(taicpu.op_reg_reg_const(A_SUB,countreg,countreg,1),PF_S));
|
||||||
a_load_reg_ref(list,size2opsize[size],size2opsize[size],r,dstref);
|
a_load_reg_ref(list,size2opsize[size],size2opsize[size],r,dstref);
|
||||||
a_jmp_flags(list,F_NE,l);
|
a_jmp_flags(list,F_NE,l);
|
||||||
|
a_reg_dealloc(list,NR_DEFAULTFLAGS);
|
||||||
srcref.offset:=1;
|
srcref.offset:=1;
|
||||||
dstref.offset:=1;
|
dstref.offset:=1;
|
||||||
case count mod size of
|
case count mod size of
|
||||||
@ -2718,8 +2726,10 @@ unit cgcpu;
|
|||||||
case op of
|
case op of
|
||||||
OP_NEG:
|
OP_NEG:
|
||||||
begin
|
begin
|
||||||
|
cg.a_reg_alloc(list,NR_DEFAULTFLAGS);
|
||||||
list.concat(setoppostfix(taicpu.op_reg_reg_const(A_RSB,regdst.reglo,regsrc.reglo,0),PF_S));
|
list.concat(setoppostfix(taicpu.op_reg_reg_const(A_RSB,regdst.reglo,regsrc.reglo,0),PF_S));
|
||||||
list.concat(taicpu.op_reg_reg_const(A_RSC,regdst.reghi,regsrc.reghi,0));
|
list.concat(taicpu.op_reg_reg_const(A_RSC,regdst.reghi,regsrc.reghi,0));
|
||||||
|
cg.a_reg_dealloc(list,NR_DEFAULTFLAGS);
|
||||||
end;
|
end;
|
||||||
OP_NOT:
|
OP_NOT:
|
||||||
begin
|
begin
|
||||||
@ -2791,11 +2801,15 @@ unit cgcpu;
|
|||||||
OP_ADD:
|
OP_ADD:
|
||||||
begin
|
begin
|
||||||
if is_shifter_const(lo(value),b) then
|
if is_shifter_const(lo(value),b) then
|
||||||
list.concat(setoppostfix(taicpu.op_reg_reg_const(A_ADD,regdst.reglo,regsrc.reglo,lo(value)),PF_S))
|
begin
|
||||||
|
cg.a_reg_alloc(list,NR_DEFAULTFLAGS);
|
||||||
|
list.concat(setoppostfix(taicpu.op_reg_reg_const(A_ADD,regdst.reglo,regsrc.reglo,lo(value)),PF_S))
|
||||||
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
tmpreg:=cg.getintregister(list,OS_32);
|
tmpreg:=cg.getintregister(list,OS_32);
|
||||||
cg.a_load_const_reg(list,OS_32,lo(value),tmpreg);
|
cg.a_load_const_reg(list,OS_32,lo(value),tmpreg);
|
||||||
|
cg.a_reg_alloc(list,NR_DEFAULTFLAGS);
|
||||||
list.concat(setoppostfix(taicpu.op_reg_reg_reg(A_ADD,regdst.reglo,regsrc.reglo,tmpreg),PF_S));
|
list.concat(setoppostfix(taicpu.op_reg_reg_reg(A_ADD,regdst.reglo,regsrc.reglo,tmpreg),PF_S));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2811,11 +2825,15 @@ unit cgcpu;
|
|||||||
OP_SUB:
|
OP_SUB:
|
||||||
begin
|
begin
|
||||||
if is_shifter_const(lo(value),b) then
|
if is_shifter_const(lo(value),b) then
|
||||||
list.concat(setoppostfix(taicpu.op_reg_reg_const(A_SUB,regdst.reglo,regsrc.reglo,lo(value)),PF_S))
|
begin
|
||||||
|
cg.a_reg_alloc(list,NR_DEFAULTFLAGS);
|
||||||
|
list.concat(setoppostfix(taicpu.op_reg_reg_const(A_SUB,regdst.reglo,regsrc.reglo,lo(value)),PF_S))
|
||||||
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
tmpreg:=cg.getintregister(list,OS_32);
|
tmpreg:=cg.getintregister(list,OS_32);
|
||||||
cg.a_load_const_reg(list,OS_32,lo(value),tmpreg);
|
cg.a_load_const_reg(list,OS_32,lo(value),tmpreg);
|
||||||
|
cg.a_reg_alloc(list,NR_DEFAULTFLAGS);
|
||||||
list.concat(setoppostfix(taicpu.op_reg_reg_reg(A_SUB,regdst.reglo,regsrc.reglo,tmpreg),PF_S));
|
list.concat(setoppostfix(taicpu.op_reg_reg_reg(A_SUB,regdst.reglo,regsrc.reglo,tmpreg),PF_S));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2854,11 +2872,15 @@ unit cgcpu;
|
|||||||
OP_ADD:
|
OP_ADD:
|
||||||
begin
|
begin
|
||||||
if is_shifter_const(aint(lo(value)),b) then
|
if is_shifter_const(aint(lo(value)),b) then
|
||||||
list.concat(setoppostfix(taicpu.op_reg_reg_const(A_ADD,regdst.reglo,regsrc.reglo,aint(lo(value))),PF_S))
|
begin
|
||||||
|
cg.a_reg_alloc(list,NR_DEFAULTFLAGS);
|
||||||
|
list.concat(setoppostfix(taicpu.op_reg_reg_const(A_ADD,regdst.reglo,regsrc.reglo,aint(lo(value))),PF_S))
|
||||||
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
tmpreg:=cg.getintregister(list,OS_32);
|
tmpreg:=cg.getintregister(list,OS_32);
|
||||||
cg.a_load_const_reg(list,OS_32,aint(lo(value)),tmpreg);
|
cg.a_load_const_reg(list,OS_32,aint(lo(value)),tmpreg);
|
||||||
|
cg.a_reg_alloc(list,NR_DEFAULTFLAGS);
|
||||||
list.concat(setoppostfix(taicpu.op_reg_reg_reg(A_ADD,regdst.reglo,regsrc.reglo,tmpreg),PF_S));
|
list.concat(setoppostfix(taicpu.op_reg_reg_reg(A_ADD,regdst.reglo,regsrc.reglo,tmpreg),PF_S));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2874,11 +2896,15 @@ unit cgcpu;
|
|||||||
OP_SUB:
|
OP_SUB:
|
||||||
begin
|
begin
|
||||||
if is_shifter_const(aint(lo(value)),b) then
|
if is_shifter_const(aint(lo(value)),b) then
|
||||||
list.concat(setoppostfix(taicpu.op_reg_reg_const(A_SUB,regdst.reglo,regsrc.reglo,aint(lo(value))),PF_S))
|
begin
|
||||||
|
cg.a_reg_alloc(list,NR_DEFAULTFLAGS);
|
||||||
|
list.concat(setoppostfix(taicpu.op_reg_reg_const(A_SUB,regdst.reglo,regsrc.reglo,aint(lo(value))),PF_S))
|
||||||
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
tmpreg:=cg.getintregister(list,OS_32);
|
tmpreg:=cg.getintregister(list,OS_32);
|
||||||
cg.a_load_const_reg(list,OS_32,aint(lo(value)),tmpreg);
|
cg.a_load_const_reg(list,OS_32,aint(lo(value)),tmpreg);
|
||||||
|
cg.a_reg_alloc(list,NR_DEFAULTFLAGS);
|
||||||
list.concat(setoppostfix(taicpu.op_reg_reg_reg(A_SUB,regdst.reglo,regsrc.reglo,tmpreg),PF_S));
|
list.concat(setoppostfix(taicpu.op_reg_reg_reg(A_SUB,regdst.reglo,regsrc.reglo,tmpreg),PF_S));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2911,11 +2937,13 @@ unit cgcpu;
|
|||||||
case op of
|
case op of
|
||||||
OP_ADD:
|
OP_ADD:
|
||||||
begin
|
begin
|
||||||
|
cg.a_reg_alloc(list,NR_DEFAULTFLAGS);
|
||||||
list.concat(setoppostfix(taicpu.op_reg_reg_reg(A_ADD,regdst.reglo,regsrc1.reglo,regsrc2.reglo),PF_S));
|
list.concat(setoppostfix(taicpu.op_reg_reg_reg(A_ADD,regdst.reglo,regsrc1.reglo,regsrc2.reglo),PF_S));
|
||||||
list.concat(setoppostfix(taicpu.op_reg_reg_reg(A_ADC,regdst.reghi,regsrc1.reghi,regsrc2.reghi),PF_S));
|
list.concat(setoppostfix(taicpu.op_reg_reg_reg(A_ADC,regdst.reghi,regsrc1.reghi,regsrc2.reghi),PF_S));
|
||||||
end;
|
end;
|
||||||
OP_SUB:
|
OP_SUB:
|
||||||
begin
|
begin
|
||||||
|
cg.a_reg_alloc(list,NR_DEFAULTFLAGS);
|
||||||
list.concat(setoppostfix(taicpu.op_reg_reg_reg(A_SUB,regdst.reglo,regsrc2.reglo,regsrc1.reglo),PF_S));
|
list.concat(setoppostfix(taicpu.op_reg_reg_reg(A_SUB,regdst.reglo,regsrc2.reglo,regsrc1.reglo),PF_S));
|
||||||
list.concat(setoppostfix(taicpu.op_reg_reg_reg(A_SBC,regdst.reghi,regsrc2.reghi,regsrc1.reghi),PF_S));
|
list.concat(setoppostfix(taicpu.op_reg_reg_reg(A_SBC,regdst.reghi,regsrc2.reghi,regsrc1.reghi),PF_S));
|
||||||
end;
|
end;
|
||||||
@ -2944,13 +2972,17 @@ unit cgcpu;
|
|||||||
end;
|
end;
|
||||||
OP_ADD:
|
OP_ADD:
|
||||||
begin
|
begin
|
||||||
|
cg.a_reg_alloc(list,NR_DEFAULTFLAGS);
|
||||||
list.concat(setoppostfix(taicpu.op_reg_reg_reg(A_ADD,regdst.reglo,regsrc1.reglo,regsrc2.reglo),PF_S));
|
list.concat(setoppostfix(taicpu.op_reg_reg_reg(A_ADD,regdst.reglo,regsrc1.reglo,regsrc2.reglo),PF_S));
|
||||||
list.concat(taicpu.op_reg_reg_reg(A_ADC,regdst.reghi,regsrc1.reghi,regsrc2.reghi));
|
list.concat(taicpu.op_reg_reg_reg(A_ADC,regdst.reghi,regsrc1.reghi,regsrc2.reghi));
|
||||||
|
cg.a_reg_dealloc(list,NR_DEFAULTFLAGS);
|
||||||
end;
|
end;
|
||||||
OP_SUB:
|
OP_SUB:
|
||||||
begin
|
begin
|
||||||
|
cg.a_reg_alloc(list,NR_DEFAULTFLAGS);
|
||||||
list.concat(setoppostfix(taicpu.op_reg_reg_reg(A_SUB,regdst.reglo,regsrc2.reglo,regsrc1.reglo),PF_S));
|
list.concat(setoppostfix(taicpu.op_reg_reg_reg(A_SUB,regdst.reglo,regsrc2.reglo,regsrc1.reglo),PF_S));
|
||||||
list.concat(taicpu.op_reg_reg_reg(A_SBC,regdst.reghi,regsrc2.reghi,regsrc1.reghi));
|
list.concat(taicpu.op_reg_reg_reg(A_SBC,regdst.reghi,regsrc2.reghi,regsrc1.reghi));
|
||||||
|
cg.a_reg_dealloc(list,NR_DEFAULTFLAGS);
|
||||||
end;
|
end;
|
||||||
else
|
else
|
||||||
internalerror(2003083101);
|
internalerror(2003083101);
|
||||||
@ -3271,13 +3303,18 @@ unit cgcpu;
|
|||||||
begin
|
begin
|
||||||
tmpreg:=getintregister(list,size);
|
tmpreg:=getintregister(list,size);
|
||||||
a_load_const_reg(list, size, a, tmpreg);
|
a_load_const_reg(list, size, a, tmpreg);
|
||||||
list.concat(setoppostfix(taicpu.op_reg_reg_reg(op_reg_reg_opcg2asmop[op],dst,src,tmpreg),toppostfix(ord(cgsetflags or setflags)*ord(PF_S))
|
if cgsetflags or setflags then
|
||||||
));
|
a_reg_alloc(list,NR_DEFAULTFLAGS);
|
||||||
|
list.concat(setoppostfix(
|
||||||
|
taicpu.op_reg_reg_reg(op_reg_reg_opcg2asmop[op],dst,src,tmpreg),toppostfix(ord(cgsetflags or setflags)*ord(PF_S))));
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
list.concat(setoppostfix(
|
begin
|
||||||
taicpu.op_reg_reg_const(op_reg_reg_opcg2asmop[op],dst,src,a),toppostfix(ord(cgsetflags or setflags)*ord(PF_S))
|
if cgsetflags or setflags then
|
||||||
));
|
a_reg_alloc(list,NR_DEFAULTFLAGS);
|
||||||
|
list.concat(setoppostfix(
|
||||||
|
taicpu.op_reg_reg_const(op_reg_reg_opcg2asmop[op],dst,src,a),toppostfix(ord(cgsetflags or setflags)*ord(PF_S))));
|
||||||
|
end;
|
||||||
if (cgsetflags or setflags) and (size in [OS_8,OS_16,OS_32]) then
|
if (cgsetflags or setflags) and (size in [OS_8,OS_16,OS_32]) then
|
||||||
begin
|
begin
|
||||||
ovloc.loc:=LOC_FLAGS;
|
ovloc.loc:=LOC_FLAGS;
|
||||||
@ -3412,9 +3449,12 @@ unit cgcpu;
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
else
|
else
|
||||||
list.concat(setoppostfix(
|
begin
|
||||||
taicpu.op_reg_reg_reg(op_reg_reg_opcg2asmopThumb2[op],dst,src2,src1),toppostfix(ord(cgsetflags or setflags)*ord(PF_S))
|
if cgsetflags or setflags then
|
||||||
));
|
a_reg_alloc(list,NR_DEFAULTFLAGS);
|
||||||
|
list.concat(setoppostfix(
|
||||||
|
taicpu.op_reg_reg_reg(op_reg_reg_opcg2asmopThumb2[op],dst,src2,src1),toppostfix(ord(cgsetflags or setflags)*ord(PF_S))));
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
maybeadjustresult(list,op,size,dst);
|
maybeadjustresult(list,op,size,dst);
|
||||||
end;
|
end;
|
||||||
@ -3810,10 +3850,12 @@ unit cgcpu;
|
|||||||
case op of
|
case op of
|
||||||
OP_NEG:
|
OP_NEG:
|
||||||
begin
|
begin
|
||||||
|
cg.a_reg_alloc(list,NR_DEFAULTFLAGS);
|
||||||
list.concat(setoppostfix(taicpu.op_reg_reg_const(A_RSB,regdst.reglo,regsrc.reglo,0),PF_S));
|
list.concat(setoppostfix(taicpu.op_reg_reg_const(A_RSB,regdst.reglo,regsrc.reglo,0),PF_S));
|
||||||
tmpreg:=cg.getintregister(list,OS_32);
|
tmpreg:=cg.getintregister(list,OS_32);
|
||||||
list.concat(taicpu.op_reg_const(A_MOV,tmpreg,0));
|
list.concat(taicpu.op_reg_const(A_MOV,tmpreg,0));
|
||||||
list.concat(taicpu.op_reg_reg_reg(A_SBC,regdst.reghi,tmpreg,regsrc.reghi));
|
list.concat(taicpu.op_reg_reg_reg(A_SBC,regdst.reghi,tmpreg,regsrc.reghi));
|
||||||
|
cg.a_reg_dealloc(list,NR_DEFAULTFLAGS);
|
||||||
end;
|
end;
|
||||||
else
|
else
|
||||||
inherited a_op64_reg_reg(list, op, size, regsrc, regdst);
|
inherited a_op64_reg_reg(list, op, size, regsrc, regdst);
|
||||||
|
@ -345,6 +345,7 @@ interface
|
|||||||
if not(right.location.loc in [LOC_CREGISTER,LOC_REGISTER]) then
|
if not(right.location.loc in [LOC_CREGISTER,LOC_REGISTER]) then
|
||||||
hlcg.location_force_reg(current_asmdata.CurrAsmList,right.location,right.resultdef,right.resultdef,true);
|
hlcg.location_force_reg(current_asmdata.CurrAsmList,right.location,right.resultdef,right.resultdef,true);
|
||||||
dummyreg:=cg.getintregister(current_asmdata.CurrAsmList,location.size);
|
dummyreg:=cg.getintregister(current_asmdata.CurrAsmList,location.size);
|
||||||
|
cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
|
||||||
current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg_reg(A_ORR,dummyreg,right.location.register64.reglo,right.location.register64.reghi),PF_S));
|
current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg_reg(A_ORR,dummyreg,right.location.register64.reglo,right.location.register64.reghi),PF_S));
|
||||||
end
|
end
|
||||||
else if (nodetype in [equaln,unequaln]) and
|
else if (nodetype in [equaln,unequaln]) and
|
||||||
|
@ -189,6 +189,7 @@ implementation
|
|||||||
begin
|
begin
|
||||||
hregister:=location.register;
|
hregister:=location.register;
|
||||||
location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
|
location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
|
||||||
|
cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
|
||||||
current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_MVF,location.register,hregister),PF_S));
|
current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_MVF,location.register,hregister),PF_S));
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -351,8 +351,10 @@ implementation
|
|||||||
hregister:=cg.getintregister(current_asmdata.CurrAsmList,opsize);
|
hregister:=cg.getintregister(current_asmdata.CurrAsmList,opsize);
|
||||||
location:=left.location;
|
location:=left.location;
|
||||||
location.register:=cg.getintregister(current_asmdata.CurrAsmList,opsize);
|
location.register:=cg.getintregister(current_asmdata.CurrAsmList,opsize);
|
||||||
|
cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
|
||||||
current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_MOV,location.register,left.location.register), PF_S));
|
current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_MOV,location.register,left.location.register), PF_S));
|
||||||
current_asmdata.CurrAsmList.concat(setcondition(taicpu.op_reg_reg_const(A_RSB,location.register,location.register, 0), C_MI));
|
current_asmdata.CurrAsmList.concat(setcondition(taicpu.op_reg_reg_const(A_RSB,location.register,location.register, 0), C_MI));
|
||||||
|
cg.a_reg_dealloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
@ -121,6 +121,9 @@ implementation
|
|||||||
else if (tordconstnode(right).value = int64(-1)) then
|
else if (tordconstnode(right).value = int64(-1)) then
|
||||||
begin
|
begin
|
||||||
// note: only in the signed case possible..., may overflow
|
// note: only in the signed case possible..., may overflow
|
||||||
|
if cs_check_overflow in current_settings.localswitches then
|
||||||
|
cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
|
||||||
|
|
||||||
current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_MVN,
|
current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_MVN,
|
||||||
resultreg,numerator),toppostfix(ord(cs_check_overflow in current_settings.localswitches)*ord(PF_S))));
|
resultreg,numerator),toppostfix(ord(cs_check_overflow in current_settings.localswitches)*ord(PF_S))));
|
||||||
end
|
end
|
||||||
@ -408,6 +411,9 @@ implementation
|
|||||||
begin
|
begin
|
||||||
shifterop_reset(so);
|
shifterop_reset(so);
|
||||||
shiftval2:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT);
|
shiftval2:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT);
|
||||||
|
|
||||||
|
cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
|
||||||
|
|
||||||
{Do we shift more than 32 bits?}
|
{Do we shift more than 32 bits?}
|
||||||
emit_instr(setoppostfix(taicpu.op_reg_reg_const(A_RSB, shiftval2, shiftval, 32), PF_S));
|
emit_instr(setoppostfix(taicpu.op_reg_reg_const(A_RSB, shiftval2, shiftval, 32), PF_S));
|
||||||
|
|
||||||
@ -424,6 +430,8 @@ implementation
|
|||||||
so.rs:=shiftval2;
|
so.rs:=shiftval2;
|
||||||
emit_instr(setcondition(taicpu.op_reg_reg_reg_shifterop(A_ORR, reg2, reg2, reg1, so), C_PL));
|
emit_instr(setcondition(taicpu.op_reg_reg_reg_shifterop(A_ORR, reg2, reg2, reg1, so), C_PL));
|
||||||
|
|
||||||
|
cg.a_reg_dealloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
|
||||||
|
|
||||||
{Final adjustments}
|
{Final adjustments}
|
||||||
if shiftright then so.shiftmode:=SM_LSR else so.shiftmode:=SM_LSL;
|
if shiftright then so.shiftmode:=SM_LSR else so.shiftmode:=SM_LSL;
|
||||||
so.rs:=shiftval;
|
so.rs:=shiftval;
|
||||||
@ -455,16 +463,20 @@ implementation
|
|||||||
if nodetype=shln then
|
if nodetype=shln then
|
||||||
begin
|
begin
|
||||||
{Shift left by one by 2 simple 32bit additions}
|
{Shift left by one by 2 simple 32bit additions}
|
||||||
|
cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
|
||||||
emit_instr(setoppostfix(taicpu.op_reg_reg_reg(A_ADD, hreg64lo, hreg64lo, hreg64lo), PF_S));
|
emit_instr(setoppostfix(taicpu.op_reg_reg_reg(A_ADD, hreg64lo, hreg64lo, hreg64lo), PF_S));
|
||||||
emit_instr(taicpu.op_reg_reg_reg(A_ADC, hreg64hi, hreg64hi, hreg64hi));
|
emit_instr(taicpu.op_reg_reg_reg(A_ADC, hreg64hi, hreg64hi, hreg64hi));
|
||||||
|
cg.a_reg_dealloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
{Shift right by first shifting hi by one and then using RRX (rotate right extended), which rotates through the carry}
|
{Shift right by first shifting hi by one and then using RRX (rotate right extended), which rotates through the carry}
|
||||||
shifterop_reset(so); so.shiftmode:=SM_LSR; so.shiftimm:=1;
|
shifterop_reset(so); so.shiftmode:=SM_LSR; so.shiftimm:=1;
|
||||||
|
cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
|
||||||
emit_instr(setoppostfix(taicpu.op_reg_reg_shifterop(A_MOV, hreg64hi, hreg64hi, so), PF_S));
|
emit_instr(setoppostfix(taicpu.op_reg_reg_shifterop(A_MOV, hreg64hi, hreg64hi, so), PF_S));
|
||||||
so.shiftmode:=SM_RRX; so.shiftimm:=0; {RRX does NOT have a shift amount}
|
so.shiftmode:=SM_RRX; so.shiftimm:=0; {RRX does NOT have a shift amount}
|
||||||
emit_instr(taicpu.op_reg_reg_shifterop(A_MOV, hreg64lo, hreg64lo, so));
|
emit_instr(taicpu.op_reg_reg_shifterop(A_MOV, hreg64lo, hreg64lo, so));
|
||||||
|
cg.a_reg_dealloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
|
||||||
end
|
end
|
||||||
{A 32bit shift just replaces a register and clears the other}
|
{A 32bit shift just replaces a register and clears the other}
|
||||||
else if v = 32 then
|
else if v = 32 then
|
||||||
|
@ -91,8 +91,9 @@ implementation
|
|||||||
if left.location.loc=LOC_CONSTANT then
|
if left.location.loc=LOC_CONSTANT then
|
||||||
begin
|
begin
|
||||||
hlcg.location_force_reg(current_asmdata.CurrAsmList, right.location,
|
hlcg.location_force_reg(current_asmdata.CurrAsmList, right.location,
|
||||||
right.resultdef, right.resultdef, true);
|
right.resultdef, right.resultdef, true);
|
||||||
|
|
||||||
|
cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
|
||||||
current_asmdata.CurrAsmList.concat(taicpu.op_reg_const(A_TST,right.location.register,1 shl (left.location.value-setbase)));
|
current_asmdata.CurrAsmList.concat(taicpu.op_reg_const(A_TST,right.location.register,1 shl (left.location.value-setbase)));
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@ -110,6 +111,7 @@ implementation
|
|||||||
shifterop_reset(so);
|
shifterop_reset(so);
|
||||||
so.rs:=left.location.register;
|
so.rs:=left.location.register;
|
||||||
so.shiftmode:=SM_LSL;
|
so.shiftmode:=SM_LSL;
|
||||||
|
cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
|
||||||
current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_shifterop(A_TST,right.location.register,hregister,so));
|
current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_shifterop(A_TST,right.location.register,hregister,so));
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user