mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-10 01:26:03 +02:00
* renamed overloaded fma functions into functions encoding explicitly the type
git-svn-id: trunk@27766 -
This commit is contained in:
parent
d5a88caecd
commit
bb129a6d6c
@ -116,14 +116,14 @@ procedure float_raise(i: TFPUExceptionMask);
|
||||
{$endif SUPPORT_EXTENDED}
|
||||
|
||||
|
||||
function fma(s1,s2,s3 : single) : single;[internproc:fpc_in_fma_single];
|
||||
function FMASingle(s1,s2,s3 : single) : single;[internproc:fpc_in_fma_single];
|
||||
{$ifdef SUPPORT_DOUBLE}
|
||||
function fma(d1,d2,d3 : double) : double;[internproc:fpc_in_fma_double];
|
||||
function FMADouble(d1,d2,d3 : double) : double;[internproc:fpc_in_fma_double];
|
||||
{$endif SUPPORT_DOUBLE}
|
||||
{$ifdef SUPPORT_EXTENDED}
|
||||
function fma(e1,e2,e3 : extended) : extended;[internproc:fpc_in_fma_extended];
|
||||
function FMAExtended(e1,e2,e3 : extended) : extended;[internproc:fpc_in_fma_extended];
|
||||
{$endif SUPPORT_EXTENDED}
|
||||
{$ifdef SUPPORT_FLOAT128}
|
||||
function fma(f1,f2,f3 : float128) : float128;[internproc:fpc_in_fma_float128];
|
||||
function FMAFloat128(f1,f2,f3 : float128) : float128;[internproc:fpc_in_fma_float128];
|
||||
{$endif SUPPORT_FLOAT128}
|
||||
|
||||
|
@ -15,231 +15,231 @@ procedure testsingle;
|
||||
l3:=4;
|
||||
s0:=0;
|
||||
|
||||
l0:=fma(l1,l2,l3);
|
||||
l0:=FMASingle(l1,l2,l3);
|
||||
writeln(l0);
|
||||
if l0<>10.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(l1+1.0,l2,l3);
|
||||
l0:=FMASingle(l1+1.0,l2,l3);
|
||||
writeln(l0);
|
||||
if l0<>13.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(l1,l1+1.0,l3);
|
||||
l0:=FMASingle(l1,l1+1.0,l3);
|
||||
writeln(l0);
|
||||
if l0<>10.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(s1,l2,l3);
|
||||
l0:=FMASingle(s1,l2,l3);
|
||||
writeln(l0);
|
||||
if l0<>10.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(l1,s2,l3);
|
||||
l0:=FMASingle(l1,s2,l3);
|
||||
writeln(l0);
|
||||
if l0<>10.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(l1,l2,s3);
|
||||
l0:=FMASingle(l1,l2,s3);
|
||||
writeln(l0);
|
||||
if l0<>10.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(s1,s2,l3);
|
||||
l0:=FMASingle(s1,s2,l3);
|
||||
writeln(l0);
|
||||
if l0<>10.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(s1,l2,s3);
|
||||
l0:=FMASingle(s1,l2,s3);
|
||||
writeln(l0);
|
||||
if l0<>10.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(l1,s2,s3);
|
||||
l0:=FMASingle(l1,s2,s3);
|
||||
writeln(l0);
|
||||
if l0<>10.0 then
|
||||
halt(1);
|
||||
|
||||
{ first operand negative }
|
||||
l0:=fma(-l1,l2,l3);
|
||||
l0:=FMASingle(-l1,l2,l3);
|
||||
writeln(l0);
|
||||
if l0<>-2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(-(l1+1.0),l2,l3);
|
||||
l0:=FMASingle(-(l1+1.0),l2,l3);
|
||||
writeln(l0);
|
||||
if l0<>-5.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(-l1,l1+1.0,l3);
|
||||
l0:=FMASingle(-l1,l1+1.0,l3);
|
||||
writeln(l0);
|
||||
if l0<>-2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(-s1,l2,l3);
|
||||
l0:=FMASingle(-s1,l2,l3);
|
||||
writeln(l0);
|
||||
if l0<>-2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(-l1,s2,l3);
|
||||
l0:=FMASingle(-l1,s2,l3);
|
||||
writeln(l0);
|
||||
if l0<>-2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(-l1,l2,s3);
|
||||
l0:=FMASingle(-l1,l2,s3);
|
||||
writeln(l0);
|
||||
if l0<>-2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(-s1,s2,l3);
|
||||
l0:=FMASingle(-s1,s2,l3);
|
||||
writeln(l0);
|
||||
if l0<>-2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(-s1,l2,s3);
|
||||
l0:=FMASingle(-s1,l2,s3);
|
||||
writeln(l0);
|
||||
if l0<>-2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(-l1,s2,s3);
|
||||
l0:=FMASingle(-l1,s2,s3);
|
||||
writeln(l0);
|
||||
if l0<>-2.0 then
|
||||
halt(1);
|
||||
|
||||
{ second operand negative }
|
||||
l0:=fma(l1,-l2,l3);
|
||||
l0:=FMASingle(l1,-l2,l3);
|
||||
writeln(l0);
|
||||
if l0<>-2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(l1+1.0,-l2,l3);
|
||||
l0:=FMASingle(l1+1.0,-l2,l3);
|
||||
writeln(l0);
|
||||
if l0<>-5.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(l1,-(l1+1.0),l3);
|
||||
l0:=FMASingle(l1,-(l1+1.0),l3);
|
||||
writeln(l0);
|
||||
if l0<>-2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(s1,-l2,l3);
|
||||
l0:=FMASingle(s1,-l2,l3);
|
||||
writeln(l0);
|
||||
if l0<>-2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(l1,-s2,l3);
|
||||
l0:=FMASingle(l1,-s2,l3);
|
||||
writeln(l0);
|
||||
if l0<>-2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(l1,-l2,s3);
|
||||
l0:=FMASingle(l1,-l2,s3);
|
||||
writeln(l0);
|
||||
if l0<>-2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(s1,-s2,l3);
|
||||
l0:=FMASingle(s1,-s2,l3);
|
||||
writeln(l0);
|
||||
if l0<>-2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(s1,-l2,s3);
|
||||
l0:=FMASingle(s1,-l2,s3);
|
||||
writeln(l0);
|
||||
if l0<>-2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(l1,-s2,s3);
|
||||
l0:=FMASingle(l1,-s2,s3);
|
||||
writeln(l0);
|
||||
if l0<>-2.0 then
|
||||
halt(1);
|
||||
|
||||
{ third operand negative }
|
||||
l0:=fma(l1,l2,-l3);
|
||||
l0:=FMASingle(l1,l2,-l3);
|
||||
writeln(l0);
|
||||
if l0<>2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(l1+1.0,l2,-l3);
|
||||
l0:=FMASingle(l1+1.0,l2,-l3);
|
||||
writeln(l0);
|
||||
if l0<>5.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(l1,l1+1.0,-l3);
|
||||
l0:=FMASingle(l1,l1+1.0,-l3);
|
||||
writeln(l0);
|
||||
if l0<>2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(s1,l2,-l3);
|
||||
l0:=FMASingle(s1,l2,-l3);
|
||||
writeln(l0);
|
||||
if l0<>2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(l1,s2,-l3);
|
||||
l0:=FMASingle(l1,s2,-l3);
|
||||
writeln(l0);
|
||||
if l0<>2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(l1,l2,-s3);
|
||||
l0:=FMASingle(l1,l2,-s3);
|
||||
writeln(l0);
|
||||
if l0<>2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(s1,s2,-l3);
|
||||
l0:=FMASingle(s1,s2,-l3);
|
||||
writeln(l0);
|
||||
if l0<>2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(s1,l2,-s3);
|
||||
l0:=FMASingle(s1,l2,-s3);
|
||||
writeln(l0);
|
||||
if l0<>2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(l1,s2,-s3);
|
||||
l0:=FMASingle(l1,s2,-s3);
|
||||
writeln(l0);
|
||||
if l0<>2.0 then
|
||||
halt(1);
|
||||
|
||||
{ first and third operand negative }
|
||||
l0:=fma(-l1,l2,-l3);
|
||||
l0:=FMASingle(-l1,l2,-l3);
|
||||
writeln(l0);
|
||||
if l0<>-10.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(-(l1+1.0),l2,-l3);
|
||||
l0:=FMASingle(-(l1+1.0),l2,-l3);
|
||||
writeln(l0);
|
||||
if l0<>-13.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(-l1,l1+1.0,-l3);
|
||||
l0:=FMASingle(-l1,l1+1.0,-l3);
|
||||
writeln(l0);
|
||||
if l0<>-10.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(-s1,l2,-l3);
|
||||
l0:=FMASingle(-s1,l2,-l3);
|
||||
writeln(l0);
|
||||
if l0<>-10.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(-l1,s2,-l3);
|
||||
l0:=FMASingle(-l1,s2,-l3);
|
||||
writeln(l0);
|
||||
if l0<>-10.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(-l1,l2,-s3);
|
||||
l0:=FMASingle(-l1,l2,-s3);
|
||||
writeln(l0);
|
||||
if l0<>-10.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(-s1,s2,-l3);
|
||||
l0:=FMASingle(-s1,s2,-l3);
|
||||
writeln(l0);
|
||||
if l0<>-10.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(-s1,l2,-s3);
|
||||
l0:=FMASingle(-s1,l2,-s3);
|
||||
writeln(l0);
|
||||
if l0<>-10.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(-l1,s2,-s3);
|
||||
l0:=FMASingle(-l1,s2,-s3);
|
||||
writeln(l0);
|
||||
if l0<>-10.0 then
|
||||
halt(1);
|
||||
@ -255,231 +255,231 @@ procedure testdouble;
|
||||
l3:=4;
|
||||
d0:=0;
|
||||
|
||||
l0:=fma(l1,l2,l3);
|
||||
l0:=FMADouble(l1,l2,l3);
|
||||
writeln(l0);
|
||||
if l0<>10.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(l1+1.0,l2,l3);
|
||||
l0:=FMADouble(l1+1.0,l2,l3);
|
||||
writeln(l0);
|
||||
if l0<>13.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(l1,l1+1.0,l3);
|
||||
l0:=FMADouble(l1,l1+1.0,l3);
|
||||
writeln(l0);
|
||||
if l0<>10.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(d1,l2,l3);
|
||||
l0:=FMADouble(d1,l2,l3);
|
||||
writeln(l0);
|
||||
if l0<>10.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(l1,d2,l3);
|
||||
l0:=FMADouble(l1,d2,l3);
|
||||
writeln(l0);
|
||||
if l0<>10.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(l1,l2,d3);
|
||||
l0:=FMADouble(l1,l2,d3);
|
||||
writeln(l0);
|
||||
if l0<>10.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(d1,d2,l3);
|
||||
l0:=FMADouble(d1,d2,l3);
|
||||
writeln(l0);
|
||||
if l0<>10.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(d1,l2,d3);
|
||||
l0:=FMADouble(d1,l2,d3);
|
||||
writeln(l0);
|
||||
if l0<>10.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(l1,d2,d3);
|
||||
l0:=FMADouble(l1,d2,d3);
|
||||
writeln(l0);
|
||||
if l0<>10.0 then
|
||||
halt(1);
|
||||
|
||||
{ first operand negative }
|
||||
l0:=fma(-l1,l2,l3);
|
||||
l0:=FMADouble(-l1,l2,l3);
|
||||
writeln(l0);
|
||||
if l0<>-2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(-(l1+1.0),l2,l3);
|
||||
l0:=FMADouble(-(l1+1.0),l2,l3);
|
||||
writeln(l0);
|
||||
if l0<>-5.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(-l1,l1+1.0,l3);
|
||||
l0:=FMADouble(-l1,l1+1.0,l3);
|
||||
writeln(l0);
|
||||
if l0<>-2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(-d1,l2,l3);
|
||||
l0:=FMADouble(-d1,l2,l3);
|
||||
writeln(l0);
|
||||
if l0<>-2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(-l1,d2,l3);
|
||||
l0:=FMADouble(-l1,d2,l3);
|
||||
writeln(l0);
|
||||
if l0<>-2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(-l1,l2,d3);
|
||||
l0:=FMADouble(-l1,l2,d3);
|
||||
writeln(l0);
|
||||
if l0<>-2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(-d1,d2,l3);
|
||||
l0:=FMADouble(-d1,d2,l3);
|
||||
writeln(l0);
|
||||
if l0<>-2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(-d1,l2,d3);
|
||||
l0:=FMADouble(-d1,l2,d3);
|
||||
writeln(l0);
|
||||
if l0<>-2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(-l1,d2,d3);
|
||||
l0:=FMADouble(-l1,d2,d3);
|
||||
writeln(l0);
|
||||
if l0<>-2.0 then
|
||||
halt(1);
|
||||
|
||||
{ second operand negative }
|
||||
l0:=fma(l1,-l2,l3);
|
||||
l0:=FMADouble(l1,-l2,l3);
|
||||
writeln(l0);
|
||||
if l0<>-2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(l1+1.0,-l2,l3);
|
||||
l0:=FMADouble(l1+1.0,-l2,l3);
|
||||
writeln(l0);
|
||||
if l0<>-5.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(l1,-(l1+1.0),l3);
|
||||
l0:=FMADouble(l1,-(l1+1.0),l3);
|
||||
writeln(l0);
|
||||
if l0<>-2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(d1,-l2,l3);
|
||||
l0:=FMADouble(d1,-l2,l3);
|
||||
writeln(l0);
|
||||
if l0<>-2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(l1,-d2,l3);
|
||||
l0:=FMADouble(l1,-d2,l3);
|
||||
writeln(l0);
|
||||
if l0<>-2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(l1,-l2,d3);
|
||||
l0:=FMADouble(l1,-l2,d3);
|
||||
writeln(l0);
|
||||
if l0<>-2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(d1,-d2,l3);
|
||||
l0:=FMADouble(d1,-d2,l3);
|
||||
writeln(l0);
|
||||
if l0<>-2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(d1,-l2,d3);
|
||||
l0:=FMADouble(d1,-l2,d3);
|
||||
writeln(l0);
|
||||
if l0<>-2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(l1,-d2,d3);
|
||||
l0:=FMADouble(l1,-d2,d3);
|
||||
writeln(l0);
|
||||
if l0<>-2.0 then
|
||||
halt(1);
|
||||
|
||||
{ third operand negative }
|
||||
l0:=fma(l1,l2,-l3);
|
||||
l0:=FMADouble(l1,l2,-l3);
|
||||
writeln(l0);
|
||||
if l0<>2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(l1+1.0,l2,-l3);
|
||||
l0:=FMADouble(l1+1.0,l2,-l3);
|
||||
writeln(l0);
|
||||
if l0<>5.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(l1,l1+1.0,-l3);
|
||||
l0:=FMADouble(l1,l1+1.0,-l3);
|
||||
writeln(l0);
|
||||
if l0<>2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(d1,l2,-l3);
|
||||
l0:=FMADouble(d1,l2,-l3);
|
||||
writeln(l0);
|
||||
if l0<>2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(l1,d2,-l3);
|
||||
l0:=FMADouble(l1,d2,-l3);
|
||||
writeln(l0);
|
||||
if l0<>2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(l1,l2,-d3);
|
||||
l0:=FMADouble(l1,l2,-d3);
|
||||
writeln(l0);
|
||||
if l0<>2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(d1,d2,-l3);
|
||||
l0:=FMADouble(d1,d2,-l3);
|
||||
writeln(l0);
|
||||
if l0<>2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(d1,l2,-d3);
|
||||
l0:=FMADouble(d1,l2,-d3);
|
||||
writeln(l0);
|
||||
if l0<>2.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(l1,d2,-d3);
|
||||
l0:=FMADouble(l1,d2,-d3);
|
||||
writeln(l0);
|
||||
if l0<>2.0 then
|
||||
halt(1);
|
||||
|
||||
{ first and third operand negative }
|
||||
l0:=fma(-l1,l2,-l3);
|
||||
l0:=FMADouble(-l1,l2,-l3);
|
||||
writeln(l0);
|
||||
if l0<>-10.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(-(l1+1.0),l2,-l3);
|
||||
l0:=FMADouble(-(l1+1.0),l2,-l3);
|
||||
writeln(l0);
|
||||
if l0<>-13.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(-l1,l1+1.0,-l3);
|
||||
l0:=FMADouble(-l1,l1+1.0,-l3);
|
||||
writeln(l0);
|
||||
if l0<>-10.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(-d1,l2,-l3);
|
||||
l0:=FMADouble(-d1,l2,-l3);
|
||||
writeln(l0);
|
||||
if l0<>-10.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(-l1,d2,-l3);
|
||||
l0:=FMADouble(-l1,d2,-l3);
|
||||
writeln(l0);
|
||||
if l0<>-10.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(-l1,l2,-d3);
|
||||
l0:=FMADouble(-l1,l2,-d3);
|
||||
writeln(l0);
|
||||
if l0<>-10.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(-d1,d2,-l3);
|
||||
l0:=FMADouble(-d1,d2,-l3);
|
||||
writeln(l0);
|
||||
if l0<>-10.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(-d1,l2,-d3);
|
||||
l0:=FMADouble(-d1,l2,-d3);
|
||||
writeln(l0);
|
||||
if l0<>-10.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(-l1,d2,-d3);
|
||||
l0:=FMADouble(-l1,d2,-d3);
|
||||
writeln(l0);
|
||||
if l0<>-10.0 then
|
||||
halt(1);
|
||||
@ -491,7 +491,7 @@ begin
|
||||
d1:=2;
|
||||
d2:=3;
|
||||
d3:=4;
|
||||
d0:=fma(d1,d2,d3);
|
||||
d0:=FMADouble(d1,d2,d3);
|
||||
writeln(d0);
|
||||
if d0<>10.0 then
|
||||
halt(1);
|
||||
@ -499,7 +499,7 @@ begin
|
||||
s1:=2;
|
||||
s2:=3;
|
||||
s3:=4;
|
||||
s0:=fma(s1,s2,s3);
|
||||
s0:=FMASingle(s1,s2,s3);
|
||||
writeln(s0);
|
||||
if s0<>10.0 then
|
||||
halt(1);
|
||||
|
Loading…
Reference in New Issue
Block a user