Search code examples
c++csseavxavx512

Multiplying different types in AVX512


I am currently trying to multiply a __m512d value with a __m512i value. The __m512d value is ln(2), so the result is saved in another __m512d variable. However, I am not able to find any intrinsics for multiplying a double with an integer in avx512. When I use the _mm512_castsi512_pd intrinsic on the __m512i, I get a wrong value, so I guess that intrinsic is not of much help either.

I am glad for any help or workaround. Thanks in advance.


Solution

  • Thanks to @Peter Cordes for pointing out the mistake regarding the difference between casting and converting. The following code allows the multiplication:

    __m512d a;
    __m512i b;
    _mm512_muld_pd(a,_mm512_cvtepi64_pd(b));