Thread overview
[work on blas] fp-contract
Dec 31, 2015
Ilya
Dec 31, 2015
Johan Engelen
Dec 31, 2015
Johan Engelen
December 31, 2015
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
December 31, 2015
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
December 31, 2015
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.