summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authoryangzhang <yangzhang@multicorewareinc.com>2013-11-07 13:50:49 +0800
committerI-Jui (Ray) Sung <ray@multicorewareinc.com>2013-11-13 17:44:12 -0600
commitd767355e1f3cda3d2eec5140abad2d26e6f70ce2 (patch)
treecf6c10bbfc867ba541a4ec665aa9df63226b9abd /sc
parent7e4bbdd944810b0a095d5797b37c007834fe3f37 (diff)
GPU Calc: implemented BITAND
AMLOEXT-149 FIX Change-Id: I4d7061993348c93bef929d0fe5484fa06e700230 Signed-off-by: haochen <haochen@multicorewareinc.com> Signed-off-by: I-Jui (Ray) Sung <ray@multicorewareinc.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/opencl/formulagroupcl.cxx4
-rw-r--r--sc/source/core/opencl/op_math.cxx39
-rw-r--r--sc/source/core/opencl/op_math.hxx7
3 files changed, 50 insertions, 0 deletions
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index 02ef7877dbde..ddaa10780f6a 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -1176,6 +1176,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(
mvSubArguments.push_back(SoPHelper(ts,
ft->Children[i], new OpArcTanH));
break;
+ case ocBitAnd:
+ mvSubArguments.push_back(SoPHelper(ts,
+ ft->Children[i], new OpBitAnd));
+ 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 2aa4b08b0072..9b8b179576dc 100644
--- a/sc/source/core/opencl/op_math.cxx
+++ b/sc/source/core/opencl/op_math.cxx
@@ -568,6 +568,45 @@ void OpArcTanH::GenSlidingWindowFunction(std::stringstream &ss,
ss << " return atanh(tmp);\n";
ss << "}";
}
+void OpBitAnd::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 = " << vSubArguments[0]->GenSlidingWindowDeclRef() << ";\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 = " << vSubArguments[1]->GenSlidingWindowDeclRef() << ";\n";
+ ss << " return (int)num1 & (int)num2;\n";
+ ss << "}";
+}
}}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/opencl/op_math.hxx b/sc/source/core/opencl/op_math.hxx
index cdbafed1fed7..008d7fac57e5 100644
--- a/sc/source/core/opencl/op_math.hxx
+++ b/sc/source/core/opencl/op_math.hxx
@@ -146,6 +146,13 @@ public:
virtual std::string GetBottom(void) { return "0.0"; }
virtual std::string BinFuncName(void) const { return "ScATanH"; }
};
+class OpBitAnd: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 "ScBitAnd"; }
+};
}}
#endif