mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-27 21:30:23 +02:00
* fix shl/shr with value > 63
This commit is contained in:
parent
71611dd39d
commit
7dd6b85e01
@ -196,6 +196,7 @@ implementation
|
|||||||
|
|
||||||
var hregisterhigh,hregisterlow:Tregister;
|
var hregisterhigh,hregisterlow:Tregister;
|
||||||
op:Tasmop;
|
op:Tasmop;
|
||||||
|
v : TConstExprInt;
|
||||||
l1,l2,l3:Tasmlabel;
|
l1,l2,l3:Tasmlabel;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -220,29 +221,20 @@ implementation
|
|||||||
{ shifting by a constant directly coded: }
|
{ shifting by a constant directly coded: }
|
||||||
if (right.nodetype=ordconstn) then
|
if (right.nodetype=ordconstn) then
|
||||||
begin
|
begin
|
||||||
{ shrd/shl works only for values <=31 !! }
|
v:=Tordconstnode(right).value and 63;
|
||||||
if Tordconstnode(right).value>63 then
|
if v>31 then
|
||||||
begin
|
|
||||||
cg.a_load_const_reg(exprasmlist,OS_32,0,hregisterhigh);
|
|
||||||
cg.a_load_const_reg(exprasmlist,OS_32,0,hregisterlow);
|
|
||||||
location.registerlow:=hregisterlow;
|
|
||||||
location.registerhigh:=hregisterhigh;
|
|
||||||
end
|
|
||||||
else if Tordconstnode(right).value>31 then
|
|
||||||
begin
|
begin
|
||||||
if nodetype=shln then
|
if nodetype=shln then
|
||||||
begin
|
begin
|
||||||
emit_reg_reg(A_XOR,S_L,hregisterhigh,hregisterhigh);
|
emit_reg_reg(A_XOR,S_L,hregisterhigh,hregisterhigh);
|
||||||
if ((tordconstnode(right).value and 31) <> 0) then
|
if ((v and 31) <> 0) then
|
||||||
emit_const_reg(A_SHL,S_L,tordconstnode(right).value and 31,
|
emit_const_reg(A_SHL,S_L,v and 31,hregisterlow);
|
||||||
hregisterlow);
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
emit_reg_reg(A_XOR,S_L,hregisterlow,hregisterlow);
|
emit_reg_reg(A_XOR,S_L,hregisterlow,hregisterlow);
|
||||||
if ((tordconstnode(right).value and 31) <> 0) then
|
if ((v and 31) <> 0) then
|
||||||
emit_const_reg(A_SHR,S_L,tordconstnode(right).value and 31,
|
emit_const_reg(A_SHR,S_L,v and 31,hregisterhigh);
|
||||||
hregisterhigh);
|
|
||||||
end;
|
end;
|
||||||
location.registerhigh:=hregisterlow;
|
location.registerhigh:=hregisterlow;
|
||||||
location.registerlow:=hregisterhigh;
|
location.registerlow:=hregisterhigh;
|
||||||
@ -251,17 +243,13 @@ implementation
|
|||||||
begin
|
begin
|
||||||
if nodetype=shln then
|
if nodetype=shln then
|
||||||
begin
|
begin
|
||||||
emit_const_reg_reg(A_SHLD,S_L,tordconstnode(right).value and 31,
|
emit_const_reg_reg(A_SHLD,S_L,v and 31,hregisterlow,hregisterhigh);
|
||||||
hregisterlow,hregisterhigh);
|
emit_const_reg(A_SHL,S_L,v and 31,hregisterlow);
|
||||||
emit_const_reg(A_SHL,S_L,tordconstnode(right).value and 31,
|
|
||||||
hregisterlow);
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
emit_const_reg_reg(A_SHRD,S_L,tordconstnode(right).value and 31,
|
emit_const_reg_reg(A_SHRD,S_L,v and 31,hregisterhigh,hregisterlow);
|
||||||
hregisterhigh,hregisterlow);
|
emit_const_reg(A_SHR,S_L,v and 31,hregisterhigh);
|
||||||
emit_const_reg(A_SHR,S_L,tordconstnode(right).value and 31,
|
|
||||||
hregisterhigh);
|
|
||||||
end;
|
end;
|
||||||
location.registerlow:=hregisterlow;
|
location.registerlow:=hregisterlow;
|
||||||
location.registerhigh:=hregisterhigh;
|
location.registerhigh:=hregisterhigh;
|
||||||
@ -354,7 +342,10 @@ begin
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.69 2004-01-20 12:59:37 florian
|
Revision 1.70 2004-05-23 14:10:17 peter
|
||||||
|
* fix shl/shr with value > 63
|
||||||
|
|
||||||
|
Revision 1.69 2004/01/20 12:59:37 florian
|
||||||
* common addnode code for x86-64 and i386
|
* common addnode code for x86-64 and i386
|
||||||
|
|
||||||
Revision 1.68 2003/12/26 13:19:16 florian
|
Revision 1.68 2003/12/26 13:19:16 florian
|
||||||
|
Loading…
Reference in New Issue
Block a user