comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Profiling Ada binaries
Date: Mon, 1 Aug 2016 16:36:41 -0700
Date: 2016-08-01T16:36:41-07:00	[thread overview]
Message-ID: <nnome9$iac$1@dont-email.me> (raw)
In-Reply-To: <845e12db-9e2c-4d0f-a3b0-19ac50f14d24@googlegroups.com>

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


  reply	other threads:[~2016-08-01 23:36 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-22 13:24 Profiling Ada binaries Markus Schöpflin
2016-07-22 14:59 ` Alejandro R. Mosteo
2016-07-22 15:05   ` Alejandro R. Mosteo
2016-07-25  7:01     ` Markus Schöpflin
2016-07-25 16:45       ` rieachus
2016-07-25 17:14         ` Simon Wright
2016-07-25 22:05           ` rieachus
2016-07-26  8:37         ` Markus Schöpflin
2016-08-01 22:40           ` rieachus
2016-08-01 23:36             ` Jeffrey R. Carter [this message]
2016-08-02  7:00               ` Markus Schöpflin
2016-08-05  3:18               ` rieachus
2016-08-05 20:27                 ` Randy Brukardt
2016-08-02  6:39             ` Markus Schöpflin
2016-07-25  6:57   ` Markus Schöpflin
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox