3 ms·
normally there is an instruction for this called blend (since SSE4.1). There shouldn't be a need to do any bitwise magic.
by mgaunard 2y ago
normally there is an instruction for this called blend (since SSE4.1).
There shouldn't be a need to do any bitwise magic.
- jcla1 2y agoYou can get gcc to generate the blend instruction in the example given - you just have to 'force' it to use SIMD more aggressively by, for example, using -march=native.
- mgaunard 2y agoThat's not forcing anything, if you're not getting blend you're just targeting an old ISA without that instruction. It's up to you to choose your target adequately based on your deployment requirements.