mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 09:32:06 +00:00
reduce instructions by _mm512_maskz_set1_epi8
add performance test for lower/upper function
This commit is contained in:
parent
9f50d40915
commit
d1b4185392
@ -39,17 +39,16 @@ private:
|
||||
{
|
||||
const auto v_not_case_lower_bound = _mm512_set1_epi8(not_case_lower_bound - 1);
|
||||
const auto v_not_case_upper_bound = _mm512_set1_epi8(not_case_upper_bound + 1);
|
||||
const auto v_flip_case_mask = _mm512_set1_epi8(flip_case_mask);
|
||||
|
||||
for (; src < src_end_avx; src += byte_avx512, dst += byte_avx512)
|
||||
{
|
||||
const auto chars = _mm512_loadu_si512(reinterpret_cast<const __m512i *>(src));
|
||||
|
||||
const auto is_not_case
|
||||
= _mm512_and_si512(_mm512_movm_epi8(_mm512_cmpgt_epi8_mask(chars, v_not_case_lower_bound)),
|
||||
_mm512_movm_epi8(_mm512_cmplt_epi8_mask(chars, v_not_case_upper_bound)));
|
||||
= _mm512_mask_cmplt_epi8_mask(_mm512_cmpgt_epi8_mask(chars, v_not_case_lower_bound),
|
||||
chars, v_not_case_upper_bound);
|
||||
|
||||
const auto xor_mask = _mm512_and_si512(v_flip_case_mask, is_not_case);
|
||||
const auto xor_mask = _mm512_maskz_set1_epi8(is_not_case, flip_case_mask);
|
||||
|
||||
const auto cased_chars = _mm512_xor_si512(chars, xor_mask);
|
||||
|
||||
|
11
tests/performance/lower_upper_function.xml
Normal file
11
tests/performance/lower_upper_function.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<test>
|
||||
<query>select lower(randomString(16))</query>
|
||||
<query>select lower(randomString(32))</query>
|
||||
<query>select lower(randomString(64))</query>
|
||||
<query>select lower(randomString(128))</query>
|
||||
<query>select lower(randomString(256))</query>
|
||||
<query>select lower(randomString(512))</query>
|
||||
<query>select lower(randomString(1024))</query>
|
||||
<query>select lower(randomString(832))</query>
|
||||
<query>select lower(randomString(416))</query>
|
||||
</test>
|
Loading…
Reference in New Issue
Block a user