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=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: Profiling Ada binaries Date: Mon, 1 Aug 2016 16:36:41 -0700 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <04e12bd0-2c9d-f90d-2497-bf58593addfd@spam.spam> <845e12db-9e2c-4d0f-a3b0-19ac50f14d24@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Mon, 1 Aug 2016 23:36:44 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="d7c030f56102b58a2c16dea977db88bb"; logging-data="18764"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+xhdVPMiBwCbkZ3Tg3fLA+Cdai7l3EP3c=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 In-Reply-To: <845e12db-9e2c-4d0f-a3b0-19ac50f14d24@googlegroups.com> Cancel-Lock: sha1:bojgbuQSj1uQy8/ccipnjhtgi7U= Xref: news.eternal-september.org comp.lang.ada:31245 Date: 2016-08-01T16:36:41-07:00 List-Id: On 08/01/2016 03:40 PM, rieachus@comcast.net wrote: > On Tuesday, July 26, 2016 at 4:37:31 AM UTC-4, Markus Schöpflin wrote: > > >> Even using the non-generic versions I have not been able to get the hardware >> built-ins. The best I can achieve for a call to e.g. cos(X) is: > >> call ada__numerics__long_elementary_functions__cos > > Again GNAT docs to the rescue: 15.1 Machine code insertions: I think the OP would benefit from knowing why this is necessary. If you look at the body of Ada.Numerics.Long_Elementary_Functions.Cos, you'll probably find a call to {something that calls} the built-in function. If you look at the requirements for the Cos function in Annex A and Annex G (if implemented, which it is for GNAT), you'll find a number of requirements for accuracy and special cases. If you look at the definition of the built-in function, you'll likely find that it doesn't meet all of those requirements. Any call to Cos has to involve wrapping a call to the built-in function in code to ensure those requirements are met, so you won't find a call to the built-in function in the generated code. Even if the built-in function met all the requirements, the desire for the compiler to be portable will result in the call to the built-in being squirreled away, not produced by the code generator. The general rule, "If you need specific machine code, use a machine-code insertion," applies here. Of course, the result is non-portable code, while the call to the language-defined library function is portable. -- Jeff Carter "Hello! Smelly English K...niggets." Monty Python & the Holy Grail 08