std.math API rework

Iain Buclaw via Digitalmars-d digitalmars-d at puremagic.com
Thu Oct 6 13:45:24 PDT 2016


On 6 October 2016 at 22:31, Ilya Yaroshenko via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> On Thursday, 6 October 2016 at 20:07:19 UTC, Iain Buclaw wrote:
>>
>> On 6 October 2016 at 18:53, Ilya Yaroshenko via Digitalmars-d
>> <digitalmars-d at puremagic.com> wrote:
>>>
>>> [...]
>>
>>
>> If you can prove that llvm intrinsics are pure (gcc math intrinsics are
>> not) and that llvm intrinsics pass the unittest (gcc math intrinsics aren't
>> guaranteed to due to the vagary of libm implementations and quirky cpu
>> support that trades correctness for efficiency).
>>
>> [...]
>
>
> LLVM math functions are pure :P http://llvm.org/docs/LangRef.html
>

I picked a random example.

http://llvm.org/docs/LangRef.html#llvm-sin-intrinsic

"""

Semantics:

This function returns the sine of the specified operand, returning the
same values as the libm sin functions would, and handles error
conditions in the same way.

"""

This would have me believe that they are infact not pure. ;-)

But, I've never looked under the hood of LLVM, so I can only believe
those who have.  In any case, IMO, you should focus on getting this
into core.math.  That's where compiler intrinsics should go.  The
intrinsics of std.math are historical baggage and are probably due a
deprecation - that is, in the sense that their symbols be converted
into aliases.

Iain.


More information about the Digitalmars-d mailing list