mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2026-02-04 11:15:05 +01:00
* factored out left/right swapping code in smallset operations
* force the left operand into a register if both the left and
right are constants (can happen because not all set add-nodes
are handled in taddnode.simplify) because the code below
expects at least one register operand. Fixes the compilation of a.o.
taddset2 with -O3 on ppc (constant propagagation -> 2 constant
operands)
git-svn-id: trunk@27607 -
This commit is contained in:
parent
212f4d1152
commit
e0a910e813
@ -442,11 +442,18 @@ implementation
|
||||
setbase:=tsetdef(left.resultdef).setbase
|
||||
else
|
||||
setbase:=tsetdef(right.resultdef).setbase;
|
||||
if (nf_swapped in flags) and
|
||||
((nodetype=subn) or
|
||||
(left.nodetype=setelementn)) then
|
||||
swapleftright;
|
||||
{ we don't support two constant locations (should ideally be handled
|
||||
in simplify }
|
||||
if (left.location.loc=LOC_CONSTANT) and
|
||||
(right.location.loc=LOC_CONSTANT) then
|
||||
hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,left.resultdef,true);
|
||||
case nodetype of
|
||||
addn :
|
||||
begin
|
||||
if (nf_swapped in flags) and (left.nodetype=setelementn) then
|
||||
swapleftright;
|
||||
{ are we adding set elements ? }
|
||||
if right.nodetype=setelementn then
|
||||
begin
|
||||
@ -483,18 +490,10 @@ implementation
|
||||
subn :
|
||||
begin
|
||||
cgop:=OP_AND;
|
||||
if (not(nf_swapped in flags)) then
|
||||
if (right.location.loc=LOC_CONSTANT) then
|
||||
right.location.value := not(right.location.value)
|
||||
else
|
||||
opdone := true
|
||||
else if (left.location.loc=LOC_CONSTANT) then
|
||||
left.location.value := not(left.location.value)
|
||||
if (right.location.loc=LOC_CONSTANT) then
|
||||
right.location.value := not(right.location.value)
|
||||
else
|
||||
begin
|
||||
swapleftright;
|
||||
opdone := true;
|
||||
end;
|
||||
opdone := true;
|
||||
if opdone then
|
||||
begin
|
||||
if left.location.loc = LOC_CONSTANT then
|
||||
|
||||
Loading…
Reference in New Issue
Block a user