Bug #2035

Updated by Sender Ghost about 2 years ago

There is following error when using Clang 3.4.1 compiler on FreeBSD 10.4 amd64 (for Intel Core 2 Quad CPU):
<pre>In In file included from <..>/upp/uppsrc/Core/Ops.h:347:
/usr/include/clang/3.4.1/smmintrin.h:28:2: error: "SSE4.1 instruction set not enabled"
#error "SSE4.1 instruction set not enabled"</pre> enabled&quot;

This is because of usage of
<pre>#ifndef #ifndef __SSE4_1__
#error "SSE4.1 instruction set not enabled"</pre> enabled&quot;

for *smmintrin.h* &lt;smmintrin.h&gt; include before Clang 3.8.0 version:
https://github.com/llvm/llvm-project/blob/llvmorg-3.4.1/clang/lib/Headers/smmintrin.h#L27-L28
https://github.com/llvm/llvm-project/blob/llvmorg-3.7.1/clang/lib/Headers/smmintrin.h#L27-L28
https://github.com/llvm/llvm-project/blob/llvmorg-3.8.0/clang/lib/Headers/smmintrin.h#L26

The same source code builds ok with using Clang 9.0.1 compiler.

There is usage of SSE2 instuction set https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set1_epi32&amp;expand=4946

I propose to use *emmintrin.h* emmintrin.h (SSE2) instead of *smmintrin.h* smmintrin.h (SSE4.1) include and check for *<notextile>__SSE2__</notextile>* __SSE2__ define, because there is usage of SSE2 intrinsics in *huge_memsetd* huge_memsetd and *memsetd* memsetd functions:
https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set1_epi32&expand=4946

Some examples of how to use various *<notextile>*mmintrin.h</notextile>* *mmintrin.h header files:
uppsrc/plugin/Eigen/Eigen/src/Core/util/ConfigureVectorization.h:
https://github.com/ultimatepp/ultimatepp/blob/f963516253431f6cb8a7145ee6f3f8a5f61dd567/uppsrc/plugin/Eigen/Eigen/src/Core/util/ConfigureVectorization.h#L336-L359
uppsrc/plugin/glm/simd/platform.h:
https://github.com/ultimatepp/ultimatepp/blob/d10614cdcbacb498faae6685078a0fe463a5a4c9/uppsrc/plugin/glm/simd/platform.h#L325-L342

Back