x86 - _mm256_testz_pd not working? -


i'm working on core i7 on linux , using g++ 4.63.

i tried following code:

#include <iostream> #include <immintrin.h>  int main() { __m256d = _mm256_set_pd(1,2,3,4); __m256d z = _mm256_setzero_pd(); std::cout << _mm256_testz_pd(a,a) << std::endl; std::cout << _mm256_testz_pd(z,z) << std::endl; std::cout << _mm256_testz_pd(a,z) << std::endl; } 

it printed 3 1's. expecting @ least 1 of them 0.

i tried using _mm256_castpd_si256 , _mm256_testz_si256, it'll print 0 first line.

why?

whereas _mm256_testz_si256 (vptest) operates on bits in source vectors, _mm256_testz_pd (vtestpd) operates on sign bit of each double precision element. in test sign bits in both vectors zero, you're getting correct result.


Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -