Thread overview
Performance problem with floor
Jun 22, 2014
bearophile
Jun 22, 2014
Orvid King
Jun 22, 2014
David Nadlinger
June 22, 2014
If someone here has followed this thread, ldc2 has big performance problems with the function "floor":

http://forum.dlang.org/thread/lo19l7$n2a$1@digitalmars.com

Bye,
bearophile
June 22, 2014
On 6/22/2014 1:49 PM, bearophile wrote:
> If someone here has followed this thread, ldc2 has big performance
> problems with the function "floor":
>
> http://forum.dlang.org/thread/lo19l7$n2a$1@digitalmars.com
>
> Bye,
> bearophile

Well, unless LDC is doing something somewhere that I can't find, Clang
is using llvm's floor intrinsic, while LDC is using the non-inline asm
version of floor in phobos. There is however a declaration for llvm's
floor intrinsic in ldc.intrinsics : llvm_floor, but, with my limited
knowledge of LDC's inner workings, I don't believe that is what is being
used when you call std.math : floor. core.stdc.math would be using the
standard C library's floor function, which would be using an intrinsic
for floor.
June 22, 2014
On 22 Jun 2014, at 21:33, Orvid King via digitalmars-d-ldc wrote:
> On 6/22/2014 1:49 PM, bearophile wrote:
>> If someone here has followed this thread, ldc2 has big performance
>> problems with the function "floor":
> Well, unless LDC is doing something somewhere that I can't find, […]

The problem is that we somehow ended up with Iain's pure, multi-bitwidth D implementation being the default.

We should make our std.math call llvm.floor.*, or at least the C standard library one by default. Anybody wants to cook up a pull request for ldc-developers/phobos?

Thanks,
David