mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 20:29:17 +02:00
Fixed an off-by-one error in a_load_const_cgpara which caused some problems.
Added some minor CG optimizations. git-svn-id: trunk@32088 -
This commit is contained in:
parent
be6bcb71dc
commit
1a285a7d24
@ -316,10 +316,11 @@ unit cgcpu;
|
|||||||
hp:=paraloc.location;
|
hp:=paraloc.location;
|
||||||
|
|
||||||
i:=1;
|
i:=1;
|
||||||
while i<tcgsize2size[paraloc.Size] do
|
while i<=tcgsize2size[paraloc.Size] do
|
||||||
begin
|
begin
|
||||||
if not(assigned(hp)) then
|
if not(assigned(hp)) then
|
||||||
internalerror(2014011105);
|
internalerror(2014011105);
|
||||||
|
//paramanager.allocparaloc(list,hp);
|
||||||
case hp^.loc of
|
case hp^.loc of
|
||||||
LOC_REGISTER,LOC_CREGISTER:
|
LOC_REGISTER,LOC_CREGISTER:
|
||||||
begin
|
begin
|
||||||
@ -327,8 +328,9 @@ unit cgcpu;
|
|||||||
(hp^.shiftval<>0) then
|
(hp^.shiftval<>0) then
|
||||||
internalerror(2015041101);
|
internalerror(2015041101);
|
||||||
a_load_const_reg(list,hp^.size,(a shr (8*(i-1))) and $ff,hp^.register);
|
a_load_const_reg(list,hp^.size,(a shr (8*(i-1))) and $ff,hp^.register);
|
||||||
|
|
||||||
|
inc(i,tcgsize2size[hp^.size]);
|
||||||
hp:=hp^.Next;
|
hp:=hp^.Next;
|
||||||
inc(i);
|
|
||||||
end;
|
end;
|
||||||
LOC_REFERENCE,LOC_CREFERENCE:
|
LOC_REFERENCE,LOC_CREFERENCE:
|
||||||
begin
|
begin
|
||||||
@ -776,7 +778,8 @@ unit cgcpu;
|
|||||||
begin
|
begin
|
||||||
for i:=1 to tcgsize2size[size] do
|
for i:=1 to tcgsize2size[size] do
|
||||||
begin
|
begin
|
||||||
list.concat(taicpu.op_reg_const(A_ORI,reg,(qword(a) and mask) shr shift));
|
if ((qword(a) and mask) shr shift)<>0 then
|
||||||
|
list.concat(taicpu.op_reg_const(A_ORI,reg,(qword(a) and mask) shr shift));
|
||||||
NextReg;
|
NextReg;
|
||||||
mask:=mask shl 8;
|
mask:=mask shl 8;
|
||||||
inc(shift,8);
|
inc(shift,8);
|
||||||
@ -786,7 +789,10 @@ unit cgcpu;
|
|||||||
begin
|
begin
|
||||||
for i:=1 to tcgsize2size[size] do
|
for i:=1 to tcgsize2size[size] do
|
||||||
begin
|
begin
|
||||||
list.concat(taicpu.op_reg_const(A_ANDI,reg,(qword(a) and mask) shr shift));
|
if ((qword(a) and mask) shr shift)=0 then
|
||||||
|
list.concat(taicpu.op_reg_reg(A_MOV,reg,NR_R1))
|
||||||
|
else
|
||||||
|
list.concat(taicpu.op_reg_const(A_ANDI,reg,(qword(a) and mask) shr shift));
|
||||||
NextReg;
|
NextReg;
|
||||||
mask:=mask shl 8;
|
mask:=mask shl 8;
|
||||||
inc(shift,8);
|
inc(shift,8);
|
||||||
@ -794,7 +800,10 @@ unit cgcpu;
|
|||||||
end;
|
end;
|
||||||
OP_SUB:
|
OP_SUB:
|
||||||
begin
|
begin
|
||||||
list.concat(taicpu.op_reg_const(A_SUBI,reg,a and mask));
|
if ((a and mask)=1) and (tcgsize2size[size]=1) then
|
||||||
|
list.concat(taicpu.op_reg(A_DEC,reg))
|
||||||
|
else
|
||||||
|
list.concat(taicpu.op_reg_const(A_SUBI,reg,a and mask));
|
||||||
if size in [OS_S16,OS_16,OS_S32,OS_32,OS_S64,OS_64] then
|
if size in [OS_S16,OS_16,OS_S32,OS_32,OS_S64,OS_64] then
|
||||||
begin
|
begin
|
||||||
for i:=2 to tcgsize2size[size] do
|
for i:=2 to tcgsize2size[size] do
|
||||||
@ -882,6 +891,8 @@ unit cgcpu;
|
|||||||
curvalue:=a and mask;
|
curvalue:=a and mask;
|
||||||
if curvalue=0 then
|
if curvalue=0 then
|
||||||
list.concat(taicpu.op_reg_reg(A_ADD,reg,NR_R1))
|
list.concat(taicpu.op_reg_reg(A_ADD,reg,NR_R1))
|
||||||
|
else if (curvalue=1) and (tcgsize2size[size]=1) then
|
||||||
|
list.concat(taicpu.op_reg(A_INC,reg))
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
tmpreg:=getintregister(list,OS_8);
|
tmpreg:=getintregister(list,OS_8);
|
||||||
|
Loading…
Reference in New Issue
Block a user