masked loads?
Matthias Kretz
[please enable javascript to see the address]
Mon Aug 8 07:37:01 CEST 2016
Hello Kay,
On Donnerstag, 21. Juli 2016 18:54:51 CEST Kay F. Jahnke wrote:
> Am 19.07.2016 um 10:10 schrieb Matthias Kretz:
> > Vector<T> x = {};
> > x(mask) = Vector<T>(mem);
>
> If mem points to ordinary memory which contains less than
> Vector<T>::Size T, is it guaranteed to be safe to construct a Vector<T>
> from mem?
That's the problem. The load constructor will access all ::Size elements in
memory. While it still may work without a crash, it is undefined behavior
according to the C++ standard, so let's not go there.
I recommend you write a function to extend Vc. E.g.
SSE::Vector<float> maskedload(SSE::Mask<float> k, const float *mem) {
return _mm_maskload_ps(mem, k.dataI());
}
Then overload the function for all the implementations you care for and submit
the patch as an issue on GitHub. I'll consider merging it in some form.
Cheers,
Matthias
--
──────────────────────────────────────────────────────────────────────────
Dr. Matthias Kretz https://kretzfamily.de
GSI Helmholtzzentrum für Schwerionenforschung https://gsi.de
SIMD easy and portable https://github.com/VcDevel/Vc
──────────────────────────────────────────────────────────────────────────
More information about the Vc
mailing list