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

GPU Calc: implemented BITLSHFIT

AMLOEXT-167 FIX

Change-Id: Ia91542a64c44d541114fee3c3655120d0350a286
Signed-off-by: 's avatarhaochen <haochen@multicorewareinc.com>
Signed-off-by: 's avatarI-Jui (Ray) Sung <ray@multicorewareinc.com>
üst dfbd5182
...@@ -1313,6 +1313,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments( ...@@ -1313,6 +1313,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(
mvSubArguments.push_back(SoPHelper(ts, mvSubArguments.push_back(SoPHelper(ts,
ft->Children[i], new OpBitOr)); ft->Children[i], new OpBitOr));
break; break;
case ocBitLshift:
mvSubArguments.push_back(SoPHelper(ts,
ft->Children[i], new OpBitLshift));
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"))))
......
...@@ -1422,7 +1422,50 @@ void OpBitOr::GenSlidingWindowFunction(std::stringstream &ss, ...@@ -1422,7 +1422,50 @@ void OpBitOr::GenSlidingWindowFunction(std::stringstream &ss,
ss << " return (long)num1 | (long)num2;\n"; ss << " return (long)num1 | (long)num2;\n";
ss << "}"; ss << "}";
} }
void OpBitLshift::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 num = " << GetBottom() << ";\n";
ss << " double shift_amount = " << GetBottom() << ";\n";
#ifdef ISNAN
FormulaToken *iNum = vSubArguments[0]->GetFormulaToken();
const formula::SingleVectorRefToken* tmpCurDVRNum=
dynamic_cast<const formula::SingleVectorRefToken*>(iNum);
FormulaToken *iShiftAmount = vSubArguments[1]->GetFormulaToken();
const formula::SingleVectorRefToken* tmpCurDVRShiftAmount=
dynamic_cast<const formula::SingleVectorRefToken*>(iShiftAmount);
ss << " int buffer_num_len = "<< tmpCurDVRNum->GetArrayLength()<<";\n";
ss << " int buffer_shift_amount_len = ";
ss << tmpCurDVRShiftAmount->GetArrayLength() << ";\n";
ss << " if((gid0)>=buffer_num_len || isNan(";
ss << vSubArguments[0]->GenSlidingWindowDeclRef() << "))\n";
ss << " num = " << GetBottom() << ";\n";
ss << " else\n ";
#endif
ss << " num = floor(";
ss << vSubArguments[0]->GenSlidingWindowDeclRef() << ");\n";
#ifdef ISNAN
ss << " if((gid0)>=buffer_shift_amount_len || isNan(";
ss << vSubArguments[1]->GenSlidingWindowDeclRef() << "))\n";
ss << " shift_amount = " << GetBottom() << ";\n";
ss << " else\n ";
#endif
ss << " shift_amount = floor(";
ss << vSubArguments[1]->GenSlidingWindowDeclRef() << ");\n";
ss << " return floor(" << "shift_amount >= 0 ? ";
ss << "num * pow(2.0, shift_amount) : ";
ss << "num / pow(2.0, fabs(shift_amount)));\n";
ss << "}";
}
}} }}
......
...@@ -175,6 +175,13 @@ public: ...@@ -175,6 +175,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 "ScBitOr"; } virtual std::string BinFuncName(void) const { return "ScBitOr"; }
}; };
class OpBitLshift: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 "ScBitLshift"; }
};
class OpLn: public CheckVariables class OpLn: public CheckVariables
{ {
public: public:
......
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