[dmd-internals] math intrinsics

Brad Roberts braddr at puremagic.com
Mon Apr 4 18:22:21 PDT 2011


My litmus test is essentially:

1) Is it something the compiler emits code to call.  That covers pretty 
much all of _d_*.

2) Is it something that the compiler expects to be named something 
specific.  The intrinsics fall into this camp.  I don't think it that the 
compiler should look in std.intrinsic, std.math, tango.intrinsic, etc.

3) Is it something that is common across standard libraries, for example 
both Phobos and Tango, and should be shared.  I think intrinsics fall into 
this camp also.

That said, these are just guidelines for how I think about it.  There are 
no absolutes and I'm not dead set on having the math intrinsics in the 
runtime.  I saw that walter merged in the dmd parts of my change.  I don't 
intend on merging the other two parts in unless there's general agreement 
that it's the right thing to do.  Don's objections are reasonable for the 
parts that aren't direct translations to a single asm instruction.  I need 
to go back and re-read his email and look under the covers at what dmd is 
doing.  My gut says they should still move, but it's as obvious.

For what it's worth, I still think some of the lowest level utf primitive 
functions belong in and should be exposed by the runtime.  Right now 
they're duplicated between rt.mumble and std.mumble.

Later,
Brad

On Mon, 4 Apr 2011, Sean Kelly wrote:

> On Apr 1, 2011, at 11:06 PM, Brad Roberts wrote:
> 
> > Any objection to moving the math intrinsics from phobos std/math.d to druntime core/math.d similar to the bitops?  I'll
> > be happy to whip up the pull requests.
> 
> I don't know that I want stuff in druntime simply because it can be made 
> intrinsic--that's largely a QOI issue for compilers.  If there's a solid 
> justification for a core.math module, that's a different story.  One 
> easy litmus test I use for what belongs in druntime is if druntime 
> itself needs the module to implement some other functionality.  So far, 
> I've seen little need for std-defined math functions in druntime. 
> _______________________________________________ dmd-internals mailing 
> list dmd-internals at puremagic.com 
> http://lists.puremagic.com/mailman/listinfo/dmd-internals
> 


More information about the dmd-internals mailing list