Closed jccleaver closed 5 years ago
This compiler is unable to include Intel intrinsics,
yet somehow is able to define __SSE2__
?
That's an unexpected combination.
One possible solution could be to blacklist gcc <= 4.1, so that such versions compile only the universal scalar code path.
It would be great if I could find a way to test gcc 4.1, or similar, so that I wouldn't have to "blindfix" this compiler combination.
There's a candidate fix in gcc41
branch.
None of my VM support gcc 4.1, so it's a blind fix for the time being.
I can confirm that the patch in there, applied to 0.7.0, compiles successfully.
How about s/x86intrin/immintrin/g
?
immintrin.h does not appear to be present on the EL5 release (gcc 4.1.2-55). A quick history search shows it added in https://github.com/gcc-mirror/gcc/commits/master?after=0f61cb499b9440ee77e11fca505f615cb6f8c124+34&path%5B%5D=gcc&path%5B%5D=config&path%5B%5D=i386&path%5B%5D=immintrin.h so that makes sense. Possibly it was added in in gcc 4.4?
It may be correct to go with that in general, but blocking that path was what was needed here.
Does it have the sse2-only emmintrin?
We've got all of these:
[root@rhel5-x86-64 xxHash-0.7.0]# rpm -ql gcc | grep intrin
/usr/lib/gcc/x86_64-redhat-linux/4.1.1/include/ammintrin.h
/usr/lib/gcc/x86_64-redhat-linux/4.1.1/include/bmmintrin.h
/usr/lib/gcc/x86_64-redhat-linux/4.1.1/include/emmintrin.h
/usr/lib/gcc/x86_64-redhat-linux/4.1.1/include/mmintrin-common.h
/usr/lib/gcc/x86_64-redhat-linux/4.1.1/include/mmintrin.h
/usr/lib/gcc/x86_64-redhat-linux/4.1.1/include/pmmintrin.h
/usr/lib/gcc/x86_64-redhat-linux/4.1.1/include/tmmintrin.h
/usr/lib/gcc/x86_64-redhat-linux/4.1.1/include/xmmintrin.h
Oh. Alright.
I was wrong.
emmintrin is for SSE2, however immintrin, introduced with AVX, includes all headers plus AVX2, AVX512, etc.
So, if XXH_VECTOR==1, include emmintrin.h, otherwise if avx2, include immintrin.h
[rpmbuild@rhel5-x86-64 xxHash-0.7.0]$ gcc -v Using built-in specs. Target: x86_64-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --disable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=x86_64-redhat-linux Thread model: posix gcc version 4.1.2 20080704 (Red Hat 4.1.2-55)
[rpmbuild@rhel5-x86-64 xxHash-0.7.0]$ make cc -O3 -c -o xxhash.o xxhash.c In file included from xxhash.c:1017: xxh3.h:62:27: error: x86intrin.h: No such file or directory In file included from xxhash.c:1017: xxh3.h: In function ‘XXH3_accumulate_512’: xxh3.h:384: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘’ token xxh3.h:384: error: expected expression before ‘const’ xxh3.h:385: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘’ token xxh3.h:385: error: expected expression before ‘const’ xxh3.h:386: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘’ token xxh3.h:386: error: expected expression before ‘const’ xxh3.h:389: error: ‘__m128i’ undeclared (first use in this function) xxh3.h:389: error: (Each undeclared identifier is reported only once xxh3.h:389: error: for each function it appears in.) xxh3.h:390: error: expected ‘;’ before ‘const’ xxh3.h:391: error: expected ‘;’ before ‘const’ xxh3.h:392: error: expected ‘;’ before ‘const’ xxh3.h:393: error: expected ‘;’ before ‘const’ xxh3.h:394: error: expected ‘;’ before ‘const’ xxh3.h:395: error: ‘xacc’ undeclared (first use in this function) xxh3.h:395: error: ‘res’ undeclared (first use in this function) xxh3.h:395: error: ‘add’ undeclared (first use in this function) xxh3.h: In function ‘XXH3_scrambleAcc’: xxh3.h:483: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘’ token xxh3.h:483: error: expected expression before ‘const’ xxh3.h:484: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token xxh3.h:484: error: expected expression before ‘const’ xxh3.h:487: error: ‘__m128i’ undeclared (first use in this function) xxh3.h:488: error: expected ‘;’ before ‘data’ xxh3.h:489: error: expected ‘;’ before ‘const’ xxh3.h:490: error: ‘data’ undeclared (first use in this function) xxh3.h:490: error: ‘shifted’ undeclared (first use in this function) xxh3.h:492: error: expected ‘;’ before ‘const’ xxh3.h:493: error: expected ‘;’ before ‘const’ xxh3.h:495: error: expected ‘;’ before ‘const’ xxh3.h:496: error: expected ‘;’ before ‘const’ xxh3.h:497: error: expected ‘;’ before ‘const’ xxh3.h:499: error: ‘xacc’ undeclared (first use in this function) xxh3.h:499: error: ‘dk’ undeclared (first use in this function) xxh3.h:499: error: ‘dk2’ undeclared (first use in this function) make: *** [xxhash.o] Error 1