mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 22:43:01 +00:00
[UCRT] Fix GCC/Clang SIMD compilation
GCC and Clang need to mark functions that use SSE/AVX etc, either with a function attribute or a pragma around the function. strlen uses a template function that either uses SSE2 or AVX2. Previously the template was surrounded with pragmas to allow both SSE2 and AVX2, but that makes GCC assume that it can use AVX2 instructions even in the SSE2 version. To fix this the template instances are now build in individual compilation units for SSE2 and AVX, separate from the "dispatcher" function. Now ucrtbase doesn't crash anymore on GCC build. Another issue was the namespace around strnlen_mode, which has confused clang so much, that it forgot to instantiate the template code.
This commit is contained in:
parent
e2deec8235
commit
719ea022ec
5 changed files with 92 additions and 10 deletions
29
sdk/lib/ucrt/string/strnlen-sse2.cpp
Normal file
29
sdk/lib/ucrt/string/strnlen-sse2.cpp
Normal file
|
@ -0,0 +1,29 @@
|
|||
//
|
||||
// strnlen-sse2.cpp
|
||||
//
|
||||
// Copyright (c) Timo Kreuzer
|
||||
//
|
||||
// Explicit template instantiations for SSE2 str(n)len code
|
||||
//
|
||||
|
||||
#pragma GCC target("sse2")
|
||||
#define _UCRT_BUILD_SSE2
|
||||
#include "strnlen.cpp"
|
||||
|
||||
template
|
||||
size_t __cdecl common_strnlen_simd<bounded, __crt_simd_isa::sse2, uint8_t>(
|
||||
uint8_t const* const string,
|
||||
size_t const maximum_count
|
||||
) throw();
|
||||
|
||||
template
|
||||
size_t __cdecl common_strnlen_simd<bounded, __crt_simd_isa::sse2, uint16_t>(
|
||||
uint16_t const* const string,
|
||||
size_t const maximum_count
|
||||
) throw();
|
||||
|
||||
template
|
||||
size_t __cdecl common_strnlen_simd<unbounded, __crt_simd_isa::sse2, uint16_t>(
|
||||
uint16_t const* const string,
|
||||
size_t const maximum_count
|
||||
) throw();
|
Loading…
Add table
Add a link
Reference in a new issue