A small comparison

Kai Nacke kai at redstar.de
Fri Nov 22 13:44:26 PST 2013


Hi bearophile!

On Wednesday, 20 November 2013 at 22:12:29 UTC, bearophile wrote:
>
> In scientific code it's common to have small kernels that take 
> most of the run-time of a program, so it's important to shave 
> every instructions from such loops.
>
> Do you think Phobos/LDC2 are doing well enough here?

The difference between std.math.sin and core.stdc.math.sin is 
that std.math.sin is mapped to the LLVM intrinsic llvm.sin while 
core.stdc.math.sin is the sine function from the C library.

I would expect that the LLVM intrinsic is replaced with fsin (at 
least with -m32). I am unsure why this does not happen.

My understanding is that the auto-vectorizer should kick-in here 
(see http://llvm.org/docs/Vectorizers.html). I really need to go 
deeper here to understand what's happening in LLVM.

For sure, Phobos/LDC2 should do better here!!!

Regards,
Kai


More information about the digitalmars-d-ldc mailing list