From 068ae1c6c8ea0da374e6166843ab017cd0c3faab Mon Sep 17 00:00:00 2001 From: Ruiling Song Date: Fri, 1 Nov 2013 14:16:08 +0800 Subject: [PATCH] GBE: disable MulAdd pattern in instruction selection temporarily. 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 Reviewed-by: Homer Hsing --- backend/src/backend/gen_insn_selection.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/src/backend/gen_insn_selection.cpp b/backend/src/backend/gen_insn_selection.cpp index 214c2c2..6430ee8 100644 --- a/backend/src/backend/gen_insn_selection.cpp +++ b/backend/src/backend/gen_insn_selection.cpp @@ -1856,6 +1856,9 @@ namespace gbe { 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 -- 2.7.4