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, 52 insertions, 1 deletions
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index b5de018a4242..a958fbed75de 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -1309,6 +1309,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments( mvSubArguments.push_back(SoPHelper(ts, ft->Children[i], new OpArcTan2)); break; + case ocBitOr: + mvSubArguments.push_back(SoPHelper(ts, + ft->Children[i], new OpBitOr)); + 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 acf853465cc1..5ba599d71827 100644 --- a/sc/source/core/opencl/op_math.cxx +++ b/sc/source/core/opencl/op_math.cxx @@ -1381,7 +1381,47 @@ void OpFloor::GenSlidingWindowFunction( ss <<" return trunc(arg0/arg1)*arg1;\n"; ss << "}\n"; } - +void OpBitOr::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 << "}"; +} }} diff --git a/sc/source/core/opencl/op_math.hxx b/sc/source/core/opencl/op_math.hxx index 71cb27931cfe..20526d888e3a 100644 --- a/sc/source/core/opencl/op_math.hxx +++ b/sc/source/core/opencl/op_math.hxx @@ -168,6 +168,13 @@ public: virtual std::string GetBottom(void) { return "0.0"; } virtual std::string BinFuncName(void) const { return "ScBitAnd"; } }; +class OpBitOr: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 "ScBitOr"; } +}; class OpLn: public CheckVariables { public: |