www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ldc - Performance problem with floor

reply "bearophile" <bearophileHUGS lycos.com> writes:
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
Jun 22 2014
parent reply Orvid King <blah38621 gmail.com> writes:
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.
Jun 22 2014
parent David Nadlinger via digitalmars-d-ldc <digitalmars-d-ldc puremagic.com> writes:
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
Jun 22 2014