diff options
-rw-r--r-- | sc/source/core/opencl/formulagroupcl.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/opencl/op_math.cxx | 42 | ||||
-rw-r--r-- | sc/source/core/opencl/op_math.hxx | 7 |
3 files changed, 53 insertions, 0 deletions
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 729e5e9da8bd..d8f4b8a651bd 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -1321,6 +1321,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments( mvSubArguments.push_back(SoPHelper(ts, ft->Children[i], new OpBitRshift)); break; + case ocBitXor: + mvSubArguments.push_back(SoPHelper(ts, + ft->Children[i], new OpBitXor)); + break; case ocExternal: if ( !(pChild->GetExternal().compareTo(OUString( "com.sun.star.sheet.addin.Analysis.getEffect")))) diff --git a/sc/source/core/opencl/op_math.cxx b/sc/source/core/opencl/op_math.cxx index 6f34d61ee0dc..b809081b67e7 100644 --- a/sc/source/core/opencl/op_math.cxx +++ b/sc/source/core/opencl/op_math.cxx @@ -1422,6 +1422,48 @@ void OpBitOr::GenSlidingWindowFunction(std::stringstream &ss, ss << " return (long)num1 | (long)num2;\n"; ss << "}"; } +void OpBitXor::GenSlidingWindowFunction(std::stringstream &ss, + const std::string sSymName, SubArguments &vSubArguments) +{ + ss << "\ndouble " << sSymName; + ss << "_"<< BinFuncName() <<"("; + for (unsigned i = 0; i < vSubArguments.size(); i++) + { + if (i) ss << ","; + vSubArguments[i]->GenSlidingWindowDecl(ss); + } + ss << ") {\n"; + ss << " int gid0 = get_global_id(0);\n"; + ss << " double num1 = " << GetBottom() << ";\n"; + ss << " double num2 = " << GetBottom() << ";\n"; +#ifdef ISNAN + FormulaToken *iNum1 = vSubArguments[0]->GetFormulaToken(); + const formula::SingleVectorRefToken* tmpCurDVRNum1= + dynamic_cast<const formula::SingleVectorRefToken *>(iNum1); + FormulaToken *iNum2 = vSubArguments[1]->GetFormulaToken(); + const formula::SingleVectorRefToken* tmpCurDVRNum2= + dynamic_cast<const formula::SingleVectorRefToken *>(iNum2); + ss << " int buffer_num1_len = " << tmpCurDVRNum1->GetArrayLength() << ";\n"; + ss << " int buffer_num2_len = " << tmpCurDVRNum2->GetArrayLength() << ";\n"; + + ss << " if((gid0)>=buffer_num1_len || isNan("; + ss << vSubArguments[0]->GenSlidingWindowDeclRef() << "))\n"; + ss << " num1 = " << GetBottom() << ";\n"; + ss << " else\n "; +#endif + ss << " num1 = floor(" << vSubArguments[0]->GenSlidingWindowDeclRef(); + ss << ");\n"; +#ifdef ISNAN + ss << " if((gid0)>=buffer_num2_len || isNan("; + ss << vSubArguments[1]->GenSlidingWindowDeclRef() << "))\n"; + ss << " num2 = " << GetBottom() << ";\n"; + ss << " else\n "; +#endif + ss << " num2 = floor(" << vSubArguments[1]->GenSlidingWindowDeclRef(); + ss << ");\n"; + ss << " return (long)num1 ^ (long)num2;\n"; + ss << "}"; +} void OpBitLshift::GenSlidingWindowFunction(std::stringstream &ss, const std::string sSymName, SubArguments &vSubArguments) { diff --git a/sc/source/core/opencl/op_math.hxx b/sc/source/core/opencl/op_math.hxx index c794e4ad38c7..b6d2432bdccf 100644 --- a/sc/source/core/opencl/op_math.hxx +++ b/sc/source/core/opencl/op_math.hxx @@ -175,6 +175,13 @@ public: virtual std::string GetBottom(void) { return "0.0"; } virtual std::string BinFuncName(void) const { return "ScBitOr"; } }; +class OpBitXor:public Normal{ +public: + virtual void GenSlidingWindowFunction(std::stringstream &ss, + const std::string sSymName, SubArguments &vSubArguments); + virtual std::string GetBottom(void) { return "0.0"; } + virtual std::string BinFuncName(void) const { return "ScBitXor"; } +}; class OpBitLshift:public Normal{ public: virtual void GenSlidingWindowFunction(std::stringstream &ss, |