diff options
author | I-Jui (Ray) Sung <ray@multicorewareinc.com> | 2013-11-18 19:26:48 -0600 |
---|---|---|
committer | I-Jui (Ray) Sung <ray@multicorewareinc.com> | 2013-11-18 19:41:19 -0600 |
commit | b09356c2719947b0a5a112e0c9edc11995c75abb (patch) | |
tree | 37ece9df311591153d1b8c2a84fd4eaed6048a79 | |
parent | 0e52d87cb05f4307f64c0508e1afa47981fb0eae (diff) |
GPU Calc: add compile time option for using fmin/fmax intrinsics
Change-Id: I791d6c8f4335ab2c2618529f2e3d22d59c4f0b5a
-rw-r--r-- | sc/source/core/opencl/formulagroupcl.cxx | 6 | ||||
-rw-r--r-- | sc/source/core/opencl/formulagroupcl_public.hxx | 8 |
2 files changed, 12 insertions, 2 deletions
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 8c1f42b40a0b..4946dfd0e075 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 996c8985426b..e50de3731f64 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 |