www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ldc - [work on blas] fp-contract

reply Ilya <ilyayaroshenko gmail.com> writes:
Hi,

Can fp-constract flag be added to LDC to allow auto fusion of 
mull/add operations?

Is it possible to make `fp-constract` a function attribute?

Thanks,
Ilya
Dec 30 2015
parent reply Johan Engelen <j j.nl> writes:
On Thursday, 31 December 2015 at 04:32:27 UTC, Ilya wrote:
 Hi,

 Can fp-constract flag be added to LDC to allow auto fusion of 
 mull/add operations?

 Is it possible to make `fp-constract` a function attribute?
Clang implements the pragma `#pragma STDC FP_CONTRACT` (you can enable it per compound statement). I think it's good to do the same. This should be relatively simple to implement. See: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/fp-contract-pragma.cpp?view=markup
Dec 31 2015
parent Johan Engelen <j j.nl> writes:
On Thursday, 31 December 2015 at 13:07:47 UTC, Johan Engelen 
wrote:
  This should be relatively simple to implement.
I take that back. It is simple to implement the pragma itself, but actually fusing ops (in the frontend) will be some more work / requires deeper knowledge of LDC. For a future implementer: you may want to have a look at clang's "tryEmitFMulAdd()" in lib/CodeGen/CGExprScalar.cpp.
Dec 31 2015