mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 16:09:17 +02:00
* avoid widening of shl operations, this is not necessary for them either
git-svn-id: trunk@48150 -
This commit is contained in:
parent
4fd1c9ec42
commit
344aadebb9
@ -2947,7 +2947,7 @@ implementation
|
|||||||
end;
|
end;
|
||||||
notn:
|
notn:
|
||||||
result:=docheckremoveinttypeconvs(tunarynode(n).left);
|
result:=docheckremoveinttypeconvs(tunarynode(n).left);
|
||||||
addn,muln,divn,modn,andn:
|
addn,muln,divn,modn,andn,shln:
|
||||||
begin
|
begin
|
||||||
if n.nodetype in [divn,modn] then
|
if n.nodetype in [divn,modn] then
|
||||||
gotdivmod:=true;
|
gotdivmod:=true;
|
||||||
@ -2986,7 +2986,7 @@ implementation
|
|||||||
tempnode: ttempcreatenode;
|
tempnode: ttempcreatenode;
|
||||||
begin
|
begin
|
||||||
case n.nodetype of
|
case n.nodetype of
|
||||||
subn,addn,muln,divn,modn,xorn,andn,orn:
|
subn,addn,muln,divn,modn,xorn,andn,orn,shln:
|
||||||
begin
|
begin
|
||||||
exclude(n.flags,nf_internal);
|
exclude(n.flags,nf_internal);
|
||||||
if not forceunsigned and
|
if not forceunsigned and
|
||||||
@ -3341,20 +3341,20 @@ implementation
|
|||||||
to 64 bit }
|
to 64 bit }
|
||||||
if (resultdef.size <= 4) and
|
if (resultdef.size <= 4) and
|
||||||
is_64bitint(left.resultdef) and
|
is_64bitint(left.resultdef) and
|
||||||
(left.nodetype in [subn,addn,muln,divn,modn,xorn,andn,orn,notn,unaryminusn]) and
|
(left.nodetype in [subn,addn,muln,divn,modn,xorn,andn,orn,notn,unaryminusn,shln]) and
|
||||||
checkremovebiginttypeconvs(left,foundsint,[s8bit,u8bit,s16bit,u16bit,s32bit,u32bit],int64(low(longint)),high(cardinal)) then
|
checkremovebiginttypeconvs(left,foundsint,[s8bit,u8bit,s16bit,u16bit,s32bit,u32bit],int64(low(longint)),high(cardinal)) then
|
||||||
doremoveinttypeconvs(left,generrordef,not foundsint,s32inttype,u32inttype);
|
doremoveinttypeconvs(left,generrordef,not foundsint,s32inttype,u32inttype);
|
||||||
{$if defined(cpu16bitalu)}
|
{$if defined(cpu16bitalu)}
|
||||||
if (resultdef.size <= 2) and
|
if (resultdef.size <= 2) and
|
||||||
(is_32bitint(left.resultdef) or is_64bitint(left.resultdef)) and
|
(is_32bitint(left.resultdef) or is_64bitint(left.resultdef)) and
|
||||||
(left.nodetype in [subn,addn,muln,divn,modn,xorn,andn,orn,notn,unaryminusn]) and
|
(left.nodetype in [subn,addn,muln,divn,modn,xorn,andn,orn,notn,unaryminusn,shln]) and
|
||||||
checkremovebiginttypeconvs(left,foundsint,[s8bit,u8bit,s16bit,u16bit],int64(low(smallint)),high(word)) then
|
checkremovebiginttypeconvs(left,foundsint,[s8bit,u8bit,s16bit,u16bit],int64(low(smallint)),high(word)) then
|
||||||
doremoveinttypeconvs(left,generrordef,not foundsint,s16inttype,u16inttype);
|
doremoveinttypeconvs(left,generrordef,not foundsint,s16inttype,u16inttype);
|
||||||
{$endif defined(cpu16bitalu)}
|
{$endif defined(cpu16bitalu)}
|
||||||
{$if defined(cpu8bitalu)}
|
{$if defined(cpu8bitalu)}
|
||||||
if (resultdef.size<left.resultdef.size) and
|
if (resultdef.size<left.resultdef.size) and
|
||||||
is_integer(left.resultdef) and
|
is_integer(left.resultdef) and
|
||||||
(left.nodetype in [subn,addn,muln,divn,modn,xorn,andn,orn,notn,unaryminusn]) and
|
(left.nodetype in [subn,addn,muln,divn,modn,xorn,andn,orn,notn,unaryminusn,shln]) and
|
||||||
checkremovebiginttypeconvs(left,foundsint,[s8bit,u8bit],int64(low(shortint)),high(byte)) then
|
checkremovebiginttypeconvs(left,foundsint,[s8bit,u8bit],int64(low(shortint)),high(byte)) then
|
||||||
doremoveinttypeconvs(left,generrordef,not foundsint,s8inttype,u8inttype);
|
doremoveinttypeconvs(left,generrordef,not foundsint,s8inttype,u8inttype);
|
||||||
{$endif defined(cpu8bitalu)}
|
{$endif defined(cpu8bitalu)}
|
||||||
|
Loading…
Reference in New Issue
Block a user