The story starts from 'FP_CONTRACT'. In c99 spec, it describes constract
expression as:
"A floating expression may be contracted, that is, evaluated as though it
were an atomic operation, thereby omitting rounding errors implied by the
source code and the expression evaluation method."
But user can use 'pragma FP_CONTRACT OFF' to disable float contraction,
in which condition, we should not do contraction like mad optimization.
In SPIR 1.2, named metadata 'opencl.enable.FP_CONTRACT' will be used to do this.
When Clang is ready, we need refine the backend logic.
Signed-off-by: Ruiling Song <ruiling.song@intel.com>
Reviewed-by: Homer Hsing <homer.xing@intel.com>
{
using namespace ir;
+ // XXX TODO: we need a clean support of FP_CONTRACT to remove below line 'return false'
+ // if 'pragma FP_CONTRACT OFF' is used in cl kernel, we should not do mad optimization.
+ return false;
// MAD tend to increase liveness of the sources (since there are three of
// them). TODO refine this strategy. Well, we should be able at least to
// evaluate per basic block register pressure and selectively enable