made it possible to override the decision from the cgs, if a certain muln needs a helper

git-svn-id: trunk@36347 -
This commit is contained in:
Károly Balogh 2017-05-26 18:42:21 +00:00
parent 6ca8b1374b
commit b755524c38

View File

@ -73,6 +73,12 @@ interface
{ full 64 bit multiplies. }
function use_generic_mul64bit: boolean; virtual;
{$ifdef cpuneedsmulhelper}
{ override to customize to decide if the code generator }
{ can handle a given multiply node directly, or it needs helpers }
function use_mul_helper: boolean; virtual;
{$endif cpuneedsmulhelper}
{ shall be overriden if the target cpu supports
an fma instruction
}
@ -3159,6 +3165,16 @@ implementation
end;
{$ifdef cpuneedsmulhelper}
function taddnode.use_mul_helper: boolean;
begin
result:=(nodetype=muln) and
not(torddef(resultdef).ordtype in [u8bit,s8bit
{$if defined(cpu16bitalu) or defined(avr)},u16bit,s16bit{$endif}]);
end;
{$endif cpuneedsmulhelper}
function taddnode.pass_1 : tnode;
function isconstsetfewelements(p : tnode) : boolean;
@ -3345,8 +3361,7 @@ implementation
else
begin
{$ifdef cpuneedsmulhelper}
if (nodetype=muln) and not(torddef(resultdef).ordtype in [u8bit,s8bit
{$if defined(cpu16bitalu) or defined(avr)},u16bit,s16bit{$endif}]) then
if use_mul_helper then
begin
result := nil;