From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.4 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,a32653cf595422e6 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.202.37 with SMTP id kf5mr5383151pbc.7.1334920652999; Fri, 20 Apr 2012 04:17:32 -0700 (PDT) Path: r9ni77796pbh.0!nntp.google.com!news1.google.com!feed-C.news.volia.net!volia.net!news2.volia.net!feed-A.news.volia.net!news.musoftware.de!wum.musoftware.de!feeder.erje.net!news.internetdienste.de!news.tu-darmstadt.de!news.belwue.de!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Fri, 20 Apr 2012 13:17:09 +0200 From: Georg Bauhaus User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:11.0) Gecko/20120327 Thunderbird/11.0.1 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: GNAT and register allocation References: <4f9138c2$0$6628$9b4e6d93@newsspool2.arcor-online.net> In-Reply-To: <4f9138c2$0$6628$9b4e6d93@newsspool2.arcor-online.net> Message-ID: <4f9145b5$0$6557$9b4e6d93@newsspool4.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 20 Apr 2012 13:17:09 CEST NNTP-Posting-Host: 78cb456f.newsspool4.arcor-online.net X-Trace: DXC=g]]Ro`c^ObG[6=1B@oB@@@4IUKejVHPHZYW8\gm6G\Kkcg]4m[eG X-Complaints-To: usenet-abuse@arcor.de Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Date: 2012-04-20T13:17:09+02:00 List-Id: 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;