// I have this final_var = some_value < 0 ? A : B // I need to achieve same using SSE/AVX intrinsic // This is my attempt mask = _mm256_cmp_ps(some_value, _mm256_set1_ps(0.0f), _CMP_LT_OQ); part1 = _mm256_and_ps(A, mask); not_mask = _mm256_andnot_ps(mask, mask); part2 = _mm256_and_ps(B, not_mask); final_var = _mm256_or_ps(part1, part2);
However I have problem with not_mask. According to Wikipedia that's the correct way of making NOT gate using NAND gate, however not_mask is always zero (whether input is 0 or -1). Maybe I misunderstood what _mm256_andnot_ps does? Maybe there is different/easier way to solve this problem?
Thank you in advance.