torshepherd · GitHub

version / revision Operating System Compiler & Version Compiler Flags CPU
  GCC (trunk/all)          |      x86-64      |    GCC (trunk/all)        |  -mavx2      |

Testcase

using doublev = std::experimental::native_simd<double>;
using size_tv = std::experimental::rebind_simd_t<std::size_t, doublev>;
struct Bound
{
    std::vector<doublev> vals;
    std::vector<size_tv> idxs;
};
void min(Bound& a, const Bound& b) {
    for (std::size_t i = 0; i < a.vals.size(); ++i)
    {
        const auto otherIsLess = b.vals[i] < a.vals[i];
        std::experimental::where(otherIsLess, a.vals[i]) = b.vals[i];
        std::experimental::where(otherIsLess, a.idxs[i]) = b.idxs[i];
    }
}

Actual Results

This code doesn't compile (https://godbolt.org/z/666G5YTqK)

Expected Results

I couldn't find anywhere on cppreference indicating the correct pattern for this use case - how can I apply a mask to different SIMD types of different element_type's?

Read the original on github.com ↗