Add some preprocessor macros __IMAGE_SUPPORT__ and __FAST_RELAXED_MATH__ define.
authorYang Rong <rong.r.yang@intel.com>
Wed, 9 Oct 2013 08:44:47 +0000 (16:44 +0800)
committerZhigang Gong <zhigang.gong@linux.intel.com>
Wed, 9 Oct 2013 09:35:57 +0000 (17:35 +0800)
Signed-off-by: Yang Rong <rong.r.yang@intel.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
backend/src/backend/program.cpp
backend/src/ocl_stdlib.tmpl.h

index f05899e..6550eac 100644 (file)
@@ -449,6 +449,7 @@ namespace gbe {
     // Arguments to pass to the clang frontend
     vector<const char *> args;
     bool bOpt = true;
+    bool bFastMath = false;
 
     vector<std::string> useless; //hold substrings to avoid c_str free
     size_t start = 0, end = 0;
@@ -465,6 +466,7 @@ namespace gbe {
       if(str.size() == 0)
         continue;
       if(str == "-cl-opt-disable") bOpt = false;
+      if(str == "-cl-fast-relaxed-math") bFastMath = true;
       useless.push_back(str);
       args.push_back(str.c_str());
     }
@@ -475,7 +477,10 @@ namespace gbe {
     // XXX we haven't implement those builtin functions,
     // so disable it currently.
     args.push_back("-fno-builtin");
-    if(bOpt)  args.push_back("-O2");
+    if(bOpt)
+      args.push_back("-O3");
+    if(bFastMath)
+      args.push_back("-D __FAST_RELAXED_MATH__=1");
 #if LLVM_VERSION_MINOR <= 2
     args.push_back("-triple");
     args.push_back("nvptx");
index 1e3639a..1982585 100644 (file)
@@ -110,6 +110,7 @@ typedef size_t __event_t;
 #define __CL_VERSION_1_0__ 100
 #define __CL_VERSION_1_1__ 110
 #define __ENDIAN_LITTLE__ 1
+#define __IMAGE_SUPPORT__ 1
 #define __kernel_exec(X, TYPE) __kernel __attribute__((work_group_size_hint(X,1,1))) \
                                         __attribute__((vec_type_hint(TYPE)))
 #define kernel_exec(X, TYPE) __kernel_exec(X, TYPE)