Search code examples
cintrinsicsavx512

Is there an x86 intrinsic that generates the AVX512 broadcast operation from a 32 bit floating point value in memory to a 512 bit register?


The instruction exists (vbroadcastss zmm/m32) but there seems to be no intrinsic to generate it.

I can code it as

static inline  __m512 mybroadcast(float *x) {
    __m512 v;
    asm inline ( "vbroadcastss %1,%0 "
                 : "=v" (v)
                 : "m" (*x)
                 );
    return v;
}

Is there a way to do this without inline asm?


Solution

  • I think _mm512_set1_ps is what you want.

    https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm512_set1_ps&expand=5236,4980