Repository navigation
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughThe SSE2 include condition in ChangesSSE2 selection
Priority: ⬇️ Low Estimated code review effort: 1 (Trivial) | ~4 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to
|
|
| #include "stringex_memcchr_x86asm.inl" | ||
| #else | ||
| #if defined(_M_IX86) || defined(_M_X64) || defined(__SSE2__) | ||
| #if (defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))) || defined(__SSE2__) |
There was a problem hiding this comment.
MemcchrSse2 still accepts _M_IX86 without _MSC_VER or __SSE2__. If MinGW headers define _M_IX86 before that test's check and SSE2 is disabled, the test still includes the unsupported SSE2 implementation, even though this header now selects portable code. Enabling tests could therefore bring back the build error. Apply the same check to stringex_memcchr_sse2_test.cpp.
| #include "stringex_memcchr_x86asm.inl" | ||
| #else | ||
| #if defined(_M_IX86) || defined(_M_X64) || defined(__SSE2__) | ||
| #if (defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))) || defined(__SSE2__) |
There was a problem hiding this comment.
Reverse the original ordering and it will fix the problem.
#if defined(__SSE2__) || defined(_M_X64) || ( defined(_MSC_VER) && defined(_M_IX86) )
The OR check will short circuit and return a true before checking any others.
There was a problem hiding this comment.
Perhaps this can be simplified further by doing this somewhere (could be a bad idea):
#if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))
#ifndef __SSE2__
#define __SSE2__ 1
#endif
#endif
stringex.h picks the SSE2 memcchr when
_M_IX86is defined. MinGW-w64 headers define_M_IX86too, but i686 GCC does not enable SSE2 by default, so the intrinsics fail to inline and the MinGW build breaks.Now the SSE2 version is used for MSVC x86 and x64, or when the compiler defines
__SSE2__. Other builds use the portable version.Todo: