Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


How to make NOT Gate in SSE/AVX?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Zaoshi Kaba   Crossbones+   -  Reputation: 5197

Like
0Likes
Like

Posted 24 May 2014 - 03:06 AM

Hello.

// 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.



Sponsor:

#2 Zaoshi Kaba   Crossbones+   -  Reputation: 5197

Like
0Likes
Like

Posted 24 May 2014 - 07:03 AM

Solved. Afterall I WAS mistaken about _mm256_andnot_ps.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS