[Libreoffice-commits] core.git: sc/source

I-Jui Sung (Ray) ray at multicorewareinc.com
Mon Nov 18 17:42:08 PST 2013


 sc/source/core/opencl/formulagroupcl.cxx        |    6 ++++--
 sc/source/core/opencl/formulagroupcl_public.hxx |    8 ++++++++
 2 files changed, 12 insertions(+), 2 deletions(-)

New commits:
commit b09356c2719947b0a5a112e0c9edc11995c75abb
Author: I-Jui (Ray) Sung <ray at multicorewareinc.com>
Date:   Mon Nov 18 19:26:48 2013 -0600

    GPU Calc: add compile time option for using fmin/fmax intrinsics
    
    Change-Id: I791d6c8f4335ab2c2618529f2e3d22d59c4f0b5a

diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index 8c1f42b..4946dfd 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -24,6 +24,8 @@
 #include "op_logical.hxx"
 #include "op_statistical.hxx"
 #include "op_array.hxx"
+// Comment out this to turn off FMIN and FMAX intrinsics
+#define USE_FMIN_FMAX 1
 #include "formulagroupcl_public.hxx"
 
 #include <list>
@@ -1038,7 +1040,7 @@ public:
     virtual std::string GetBottom(void) { return "MAXFLOAT"; }
     virtual std::string Gen2(const std::string &lhs, const std::string &rhs) const
     {
-        return "fmin("+lhs + "," + rhs +")";
+        return "mcw_fmin("+lhs + "," + rhs +")";
     }
     virtual std::string BinFuncName(void) const { return "min"; }
 };
@@ -1048,7 +1050,7 @@ public:
     virtual std::string GetBottom(void) { return "-MAXFLOAT"; }
     virtual std::string Gen2(const std::string &lhs, const std::string &rhs) const
     {
-        return "fmax("+lhs + "," + rhs +")";
+        return "mcw_fmax("+lhs + "," + rhs +")";
     }
     virtual std::string BinFuncName(void) const { return "max"; }
 };
diff --git a/sc/source/core/opencl/formulagroupcl_public.hxx b/sc/source/core/opencl/formulagroupcl_public.hxx
index 996c898..e50de37 100644
--- a/sc/source/core/opencl/formulagroupcl_public.hxx
+++ b/sc/source/core/opencl/formulagroupcl_public.hxx
@@ -16,6 +16,14 @@ const char* publicFunc =
  "double fsub(double a, double b) { return a-b; }\n"
  "double fdiv(double a, double b) { return a/b; }\n"
  "double strequal(unsigned a, unsigned b) { return (a==b)?1.0:0; }\n"
+#ifdef USE_FMIN_FMAX
+ "double mcw_fmin(double a, double b) { return fmin(a, b); }\n"
+ "double mcw_fmax(double a, double b) { return fmax(a, b); }\n"
+#else
+ "double mcw_fmin(double a, double b) { return a>b?b:a; }\n"
+ "double mcw_fmax(double a, double b) { return a>b?a:b; }\n"
+#endif
+
  ;
 
 #endif


More information about the Libreoffice-commits mailing list