From: Georg Bauhaus <rm.dash-bauhaus@futureapps.de>
Subject: Re: GNAT and register allocation
Date: Fri, 20 Apr 2012 13:17:09 +0200
Date: 2012-04-20T13:17:09+02:00 [thread overview]
Message-ID: <4f9145b5$0$6557$9b4e6d93@newsspool4.arcor-online.net> (raw)
In-Reply-To: <4f9138c2$0$6628$9b4e6d93@newsspool2.arcor-online.net>
On 20.04.12 12:21, Georg Bauhaus wrote:
> Hi,
>
> in short, is there anything that one can do to make
> GNAT use many registers? MMX registers in particular,
> but not only.
SSE, that is, darn, the registers being named xmmN.
> It appears that the number of registers allocated increases
> with inline expansion enabled. But only so much.
In the (meaningless) example below, the translations of both
Comp.A and Comp.B will use the same set of registers, xmm0 .. xmm1.
If they were instead using xmm0 .. xmm1 and xmm2 .. xmm3,
respectively, speed might well double.
package Comp is
type F is digits 15;
function A (One, Two : F) return F;
function B (One, Two : F) return F;
end Comp;
package body Comp is
function A (One, Two : F) return F is
X, Y, Z: F;
begin
X := One - 1.0;
Y := Two / 3.14;
Z := 2.0 * X + Y;
return Z * Z;
end A;
function B (One, Two : F) return F is
X, Y, Z: F;
begin
X := One + 1.0;
Y := Two * (1.0 / 3.14);
Z := X + 2.0 * Y;
return (Z * Z) / 3.0;
end B;
function Use_Them (Start : F) return F is
Ra, Rb : F;
begin
Ra := Start;
Rb := 0.0 - Start;
for K in 1 .. 1_000_000 loop
Ra := A (Ra, Rb);
Rb := B (Ra, Rb);
end loop;
return (Ra + Rb) / 2.0;
end Use_Them;
Result : F;
pragma Volatile (Result);
begin
if Result'Valid then
Result := Use_Them (Result);
else
raise Constraint_Error;
end if;
end Comp;
next prev parent reply other threads:[~2012-04-20 11:17 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-20 10:21 GNAT and register allocation Georg Bauhaus
2012-04-20 11:17 ` Georg Bauhaus [this message]
2012-04-20 13:48 ` Markus Schöpflin
2012-04-20 15:34 ` Georg Bauhaus
2012-04-21 12:10 ` Stephen Leake
2012-04-22 16:43 ` Georg Bauhaus
2012-04-22 17:39 ` Jacob Sparre Andersen
2012-04-22 21:14 ` Georg Bauhaus
2012-04-24 12:24 ` Stephen Leake
2012-04-24 13:27 ` Georg Bauhaus
2012-04-24 18:40 ` "gnatchop" and ".gpr" files? (Was: GNAT and register allocation) Jacob Sparre Andersen
2012-04-25 11:51 ` GNAT and register allocation Stephen Leake
2012-04-25 12:54 ` Georg Bauhaus
2012-04-26 10:55 ` Stephen Leake
2012-04-26 17:15 ` Georg Bauhaus
2012-04-24 12:21 ` Stephen Leake
2012-04-22 17:30 ` Georg Bauhaus
2012-04-21 15:41 ` Florian Weimer
2012-04-22 16:53 ` Georg Bauhaus
2012-04-22 20:53 ` gautier_niouzes
2012-04-22 21:24 ` Georg Bauhaus
2012-04-23 8:43 ` gautier_niouzes
2012-04-23 16:46 ` Georg Bauhaus
2012-04-23 9:11 ` gautier_niouzes
2012-04-23 16:47 ` Georg Bauhaus
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox