简体   繁体   中英

Getting an understandable error using __m512 intel intrinsic

Hi i'm trying to use intel intrinsics. So I've made some macros that contains the intrinsics like this:

#define __M512_MM_SET_PS(dest, e15, e14, e13, e12, e11, e10, e9, e8, e7, e6, e5, e4, e3, e2, e1, e0)\
 {                                                                                                   \
dest = _mm512_set_ps(e15, e14, e13, e12, e11, e10, e9, e8, e7, e6, e5, e4, e3, e2, e1, e0);      \
 }

andtest them like so :

void test_intel_512()
{
__M512_MM_SET_PS(vec1,7.0,7.0,7.0,7.0,7.0,7.0,7.0,7.0,7.0,7.0,7.0,7.0,7.0,7.0,7.0,7.0);
__M512_MM_SET_PS(vec2,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0);
__M512_MM_ADD_PS(res,vec1,vec2);
if (res[0]==9 && res[1]==9 &&res[2]==9 && res[3]==9 && res[4]==9 && res[5]==9 && res[6]==9 && res[7]==9 &&
    res[8]==9 && res[9]==9 && res[10]==9 && res[11]==9 && res[12]==9 && res[13]==9 && res[14]==9 && res[15]==9 )
    printf("Addition : OK!\n");
else
    printf("Addition : FAILED!\n");
}

Notice : I'm using gcc-4.9 with Ubuntu 12.04 and Eclipse Mars as IDE I'm also including immintrin.h and using the the flags -mavx512f . Sadly, i'm getting these errors:

make all 
gcc -g -c -Wall -O0 -mavx -mavx512f test_inst.c -lm -o test_inst.o

Assembler messages:
Error: no such instruction: `vinsertf64x4 $0x1,%ymm1,%zmm0,%zmm0'
Error: bad register name `%zmm0'
Error: no such instruction: `vinsertf64x4 $0x1,%ymm1,%zmm0,%zmm0'
Error: bad register name `%zmm0'
Error: bad register name `%zmm0'
Error: bad register name `%zmm0'
Error: bad register name `%zmm0'
Error: bad register name `%zmm0'
Error: bad register name `%zmm0'
Error: bad register name `%zmm1'
Error: no such instruction: `kmovw %eax,%k1'
Error: bad register name `%zmm1'
Error: bad register name `%zmm0'

could someone explain to me the problem or what is wrong with this ?? Thank you

Your macro is defined in an error prone way. It cannot be used as a statement commanded by an if . You should use either:

#define __M512_MM_SET_PS(dest,e15,e14,e13,e12,e11,e10,e9,e8,e7,e6,e5,e4,e3,e2,e1,e0) \
        (dest) = _mm512_set_ps(e15,e14,e13,e12,e11,e10,e9,e8,e7,e6,e5,e4,e3,e2,e1,e0)

or

#define __M512_MM_SET_PS(dest,e15,e14,e13,e12,e11,e10,e9,e8,e7,e6,e5,e4,e3,e2,e1,e0) \
       do { \
           (dest) = _mm512_set_ps(e15,e14,e13,e12,e11,e10,e9,e8,e7,e6,e5,e4,e3,e2,e1,e0); \
       } while (0)

Regarding your question, the compiler configuration must be incomplete, inconsistent or outdated. Upgrade to a newer Ubuntu release.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM