我想转换4装64位整数4包装使用AVX 64位的花车。我已经试过类似:
int_64t 1!=(*的int64_t)_mm_malloc(256,32);LS [0] = A;// ...LS [3] = D组;__mm256i包装= _mm256_load_si256((__ m256i常量*)LS);这将在调试器中显示:
(GDB)印刷包装$ 4 = {1234,5678,9012,3456}好了,到目前为止,但我能找到的唯一的投/转换操作是_mm256i_castsi256_pd,这并不让我我想要的:
__ m256d PD = _mm256_castsi256_pd(包装);(GDB)打印PD$ 5 = {6.0967700696809824e-321,2.8053047370865979e-320,4.4525196003213139e-320,1.7074908720273481e-320}我真的很想看到的是:
(GDB)打印PD$ 5 = {1234.0,5678.0,9012.0,3456.0}解决方案
所有的投的内部函数执行按位投,这就是为什么你没有看到与有意义的结果。
一个矢量转换(即 CVT 的内部函数)的64位整数和64位浮点之间不存在。
I would like to convert 4 packed 64 bit integers to 4 packed 64 bit floats using AVX. I've tried something like:
int_64t *ls = (int64_t *) _mm_malloc(256, 32); ls[0] = a; //... ls[3] = d; __mm256i packed = _mm256_load_si256((__m256i const *)ls);Which will display in the debugger:
(gdb) print packed $4 = {1234, 5678, 9012, 3456}Okay so far, but the only cast/conversion operation that I can find is _mm256i_castsi256_pd, which doesn't get me what I want:
__m256d pd = _mm256_castsi256_pd(packed); (gdb) print pd $5 = {6.0967700696809824e-321, 2.8053047370865979e-320, 4.4525196003213139e-320, 1.7074908720273481e-320}What I'd really like to see is:
(gdb) print pd $5 = {1234.0, 5678.0, 9012.0, 3456.0}解决方案
All of the cast intrinsics perform a bitwise cast, which is why you're not seeing meaningful results with that.
A vector conversion (the cvt intrinsics) between 64-bit integer and 64-bit float does not exist.