Kaydet (Commit) d767355e authored tarafından yangzhang's avatar yangzhang Kaydeden (comit) I-Jui (Ray) Sung

GPU Calc: implemented BITAND

AMLOEXT-149 FIX

Change-Id: I4d7061993348c93bef929d0fe5484fa06e700230
Signed-off-by: 's avatarhaochen <haochen@multicorewareinc.com>
Signed-off-by: 's avatarI-Jui (Ray) Sung <ray@multicorewareinc.com>
üst 7e4bbdd9
...@@ -1176,6 +1176,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments( ...@@ -1176,6 +1176,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(
mvSubArguments.push_back(SoPHelper(ts, mvSubArguments.push_back(SoPHelper(ts,
ft->Children[i], new OpArcTanH)); ft->Children[i], new OpArcTanH));
break; break;
case ocBitAnd:
mvSubArguments.push_back(SoPHelper(ts,
ft->Children[i], new OpBitAnd));
break;
case ocExternal: case ocExternal:
if ( !(pChild->GetExternal().compareTo(OUString( if ( !(pChild->GetExternal().compareTo(OUString(
"com.sun.star.sheet.addin.Analysis.getEffect")))) "com.sun.star.sheet.addin.Analysis.getEffect"))))
......
...@@ -568,6 +568,45 @@ void OpArcTanH::GenSlidingWindowFunction(std::stringstream &ss, ...@@ -568,6 +568,45 @@ void OpArcTanH::GenSlidingWindowFunction(std::stringstream &ss,
ss << " return atanh(tmp);\n"; ss << " return atanh(tmp);\n";
ss << "}"; 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: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -146,6 +146,13 @@ public: ...@@ -146,6 +146,13 @@ public:
virtual std::string GetBottom(void) { return "0.0"; } virtual std::string GetBottom(void) { return "0.0"; }
virtual std::string BinFuncName(void) const { return "ScATanH"; } 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 #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment