| 197 | |
| 198 | |
| 199 | void GenerateMultABMask (ostream & out, int h, OP op, bool aligned_b) |
| 200 | { |
| 201 | out << "template <> inline void MatKernelMultABMask<" << h << ", " << ToString(op) << ">" << endl; |
| 202 | |
| 203 | out << " (size_t n, SIMD<mask64> mask," << endl |
| 204 | << " double * pa, size_t da," << endl |
| 205 | << " " << (aligned_b ? "SIMD<double>" : "double") << " * pb, size_t db," << endl |
| 206 | << " double * pc, size_t dc)" << endl |
| 207 | << "{" << endl; |
| 208 | // out << "constexpr int SW = SIMD<double>::Size();" << endl; |
| 209 | |
| 210 | if (op == SET || op == SETNEG) |
| 211 | { |
| 212 | for (int i = 0; i < h; i++) |
| 213 | out << "SIMD<double> sum" << i << "(0);" << endl; |
| 214 | } |
| 215 | else |
| 216 | { |
| 217 | out << "double * hpc = pc;" << endl; |
| 218 | for (int i = 0; i < h; i++) |
| 219 | { |
| 220 | out << "SIMD<double> sum" << i << "(pc, mask);" << endl; |
| 221 | out << "pc += dc;" << endl; |
| 222 | } |
| 223 | out << "pc = hpc;" << endl; |
| 224 | } |
| 225 | |
| 226 | out << "for (size_t i = 0; i < n; i++, pa++, pb += db) {" << endl; |
| 227 | out << "SIMD<double> b((double*)pb,mask);" << endl; |
| 228 | |
| 229 | for (int i = 0; i < h; i++) |
| 230 | { |
| 231 | out << "SIMD<double> a" << i << "(pa["<< i << "*da]);" << endl; |
| 232 | if (op == SET || op == ADD) |
| 233 | out << "FMAasm(a"<<i<<",b,sum" << i << ");" << endl; |
| 234 | else |
| 235 | out << "FNMAasm(a"<<i<<",b,sum" << i << ");" << endl; |
| 236 | // out << "sum" << i << " -= a" << i << "*b;" << endl; |
| 237 | } |
| 238 | out << "}" << endl; |
| 239 | |
| 240 | for (int i = 0; i < h; i++) |
| 241 | { |
| 242 | out << "sum"<< i << ".Store(pc,mask);" << endl; |
| 243 | out << "pc += dc;" << endl; |
| 244 | } |
| 245 | |
| 246 | out << "}" << endl; |
| 247 | } |
| 248 | |
| 249 | void GenerateMultABMask (ostream & out, int h) |
| 250 | { |