mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 16:09:25 +02:00
* perform the OP_AND, OP_OR and OP_XOR optimizations for 0 and $FFFF values
independently also in tcg8086.a_op_const_ref git-svn-id: trunk@26345 -
This commit is contained in:
parent
9a1e33d2a0
commit
dcb9306de8
@ -569,29 +569,62 @@ unit cgcpu;
|
|||||||
end;
|
end;
|
||||||
OP_AND, OP_OR, OP_XOR:
|
OP_AND, OP_OR, OP_XOR:
|
||||||
begin
|
begin
|
||||||
if longword(a) = high(longword) then
|
{ low word operation }
|
||||||
|
if aint(a and $FFFF) = aint(0) then
|
||||||
begin
|
begin
|
||||||
case op of
|
case op of
|
||||||
OP_AND:
|
OP_AND:
|
||||||
exit;
|
a_load_const_ref(list,OS_16,aint(0),ref);
|
||||||
OP_OR:
|
OP_OR,OP_XOR:
|
||||||
a_load_const_ref(list,size,high(longword),tmpref);
|
{do nothing};
|
||||||
OP_XOR:
|
|
||||||
begin
|
|
||||||
list.concat(taicpu.op_ref(A_NOT,S_W,tmpref));
|
|
||||||
inc(tmpref.offset, 2);
|
|
||||||
list.concat(taicpu.op_ref(A_NOT,S_W,tmpref));
|
|
||||||
end;
|
|
||||||
else
|
else
|
||||||
InternalError(2013100701);
|
InternalError(2013100701);
|
||||||
end
|
end;
|
||||||
|
end
|
||||||
|
else if aint(a and $FFFF) = aint($FFFF) then
|
||||||
|
begin
|
||||||
|
case op of
|
||||||
|
OP_AND:
|
||||||
|
{do nothing};
|
||||||
|
OP_OR:
|
||||||
|
a_load_const_ref(list,OS_16,aint($FFFF),tmpref);
|
||||||
|
OP_XOR:
|
||||||
|
list.concat(taicpu.op_ref(A_NOT,S_W,tmpref));
|
||||||
|
else
|
||||||
|
InternalError(2013100701);
|
||||||
|
end;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
|
||||||
a_op_const_ref(list,op,OS_16,aint(a and $FFFF),tmpref);
|
a_op_const_ref(list,op,OS_16,aint(a and $FFFF),tmpref);
|
||||||
inc(tmpref.offset, 2);
|
|
||||||
|
{ high word operation }
|
||||||
|
inc(tmpref.offset, 2);
|
||||||
|
if aint(a shr 16) = aint(0) then
|
||||||
|
begin
|
||||||
|
case op of
|
||||||
|
OP_AND:
|
||||||
|
a_load_const_ref(list,OS_16,aint(0),tmpref);
|
||||||
|
OP_OR,OP_XOR:
|
||||||
|
{do nothing};
|
||||||
|
else
|
||||||
|
InternalError(2013100701);
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else if aint(a shr 16) = aint($FFFF) then
|
||||||
|
begin
|
||||||
|
case op of
|
||||||
|
OP_AND:
|
||||||
|
{do nothing};
|
||||||
|
OP_OR:
|
||||||
|
a_load_const_ref(list,OS_16,aint($FFFF),tmpref);
|
||||||
|
OP_XOR:
|
||||||
|
list.concat(taicpu.op_ref(A_NOT,S_W,tmpref));
|
||||||
|
else
|
||||||
|
InternalError(2013100701);
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else
|
||||||
a_op_const_ref(list,op,OS_16,aint(a shr 16),tmpref);
|
a_op_const_ref(list,op,OS_16,aint(a shr 16),tmpref);
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
else
|
else
|
||||||
internalerror(2013050802);
|
internalerror(2013050802);
|
||||||
|
Loading…
Reference in New Issue
Block a user