-1

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

A.nechi
  • 521
  • 1
  • 5
  • 15
  • 2
    It seems that the assembler in your toolchain does not come with support for AVX512 syntax ... can you please update the question with the versions of `gcc` and `as` ? – Ferenc Deak Aug 01 '16 at 11:29
  • I doubt the assembler shipped by a distro from April 2012 supports AVX512. I'm surprised the compiler and immintrin.h support `-mavx512`, unless those were backported. Anyway, the current Ubuntu LTS release is 16.04, four years newer. – Peter Cordes Aug 01 '16 at 13:35

1 Answers1

2

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.

chqrlie
  • 131,814
  • 10
  • 121
  • 189
  • 1
    I hope the OP doesn't plan to declare + initialize a variable with something like `__M512_MM_SET_PS(__m512 tmp, ...)`. Really though, I don't see the point of a macro for that, especially not if you're going to give it a name even longer than Intel's intrinsic name. – Peter Cordes Aug 01 '16 at 15:48
  • @PeterCordes : Putting the intrinsics in macros has a purpose in my project otherwise i will not even take the trouble of making these macros. – A.nechi Aug 02 '16 at 08:49
  • @chqrlie : I'm not sure about upgrading Ubuntu because I'm using a simulator called gem5 that could be incompatible with newer versions of Ubuntu. – A.nechi Aug 02 '16 at 08:52
  • @A.nechi: [Intel's SDE](https://software.intel.com/en-us/articles/intel-software-development-emulator) works on the latest Ubuntu. You could also just install a newer compiler, like clang-3.8 ([repos for Ubuntu, including 12.04 Precise](http://apt.llvm.org/). There's probably a gcc & binutils backport repo as well. Using compilers / assemblers that only just added support for an instruction set is not likely to be a good test, since later versions probably make better code. – Peter Cordes Aug 02 '16 at 14:07