@@ -2372,17 +2372,33 @@ Literal Literal::pmaxF64x2(const Literal& other) const {
23722372 return binary<2 , &Literal::getLanesF64x2, &Literal::pmax>(*this , other);
23732373}
23742374
2375- Literal Literal::dotSI16x8toI32x4 (const Literal& other) const {
2376- LaneArray<8 > lhs = getLanesSI16x8 ();
2377- LaneArray<8 > rhs = other.getLanesSI16x8 ();
2378- LaneArray<4 > result;
2379- for (size_t i = 0 ; i < 4 ; ++i) {
2380- result[i] = Literal (lhs[i * 2 ].geti32 () * rhs[i * 2 ].geti32 () +
2381- lhs[i * 2 + 1 ].geti32 () * rhs[i * 2 + 1 ].geti32 ());
2375+ template <size_t Lanes,
2376+ size_t Factor,
2377+ LaneArray<Lanes * Factor> (Literal::*IntoLanes)() const >
2378+ static Literal dot (const Literal& left, const Literal& right) {
2379+ LaneArray<Lanes* Factor> lhs = (left.*IntoLanes)();
2380+ LaneArray<Lanes* Factor> rhs = (right.*IntoLanes)();
2381+ LaneArray<Lanes> result;
2382+ for (size_t i = 0 ; i < Lanes; ++i) {
2383+ result[i] = Literal (int32_t (0 ));
2384+ for (size_t j = 0 ; j < Factor; ++j) {
2385+ result[i] = Literal (result[i].geti32 () + lhs[i * Factor + j].geti32 () *
2386+ rhs[i * Factor + j].geti32 ());
2387+ }
23822388 }
23832389 return Literal (result);
23842390}
23852391
2392+ Literal Literal::dotSI8x16toI16x8 (const Literal& other) const {
2393+ return dot<8 , 2 , &Literal::getLanesSI8x16>(*this , other);
2394+ }
2395+ Literal Literal::dotUI8x16toI16x8 (const Literal& other) const {
2396+ return dot<8 , 2 , &Literal::getLanesUI8x16>(*this , other);
2397+ }
2398+ Literal Literal::dotSI16x8toI32x4 (const Literal& other) const {
2399+ return dot<4 , 2 , &Literal::getLanesSI16x8>(*this , other);
2400+ }
2401+
23862402Literal Literal::bitselectV128 (const Literal& left,
23872403 const Literal& right) const {
23882404 return andV128 (left).orV128 (notV128 ().andV128 (right));
0 commit comments