Skip to content

Commit d41bcea

Browse files
committed
use XSSE for bcmath
1 parent de785f9 commit d41bcea

File tree

3 files changed

+1986
-80
lines changed

3 files changed

+1986
-80
lines changed

ext/bcmath/libbcmath/src/convert.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ char *bc_copy_and_toggle_bcd(char *restrict dest, const char *source, const char
2323
{
2424
const size_t bulk_shift = SWAR_REPEAT('0');
2525

26-
#ifdef HAVE_BC_SIMD_128
26+
#ifdef XSSE2
2727
/* SIMD SSE2 or NEON bulk shift + copy */
28-
bc_simd_128_t shift_vector = bc_simd_set_8x16('0');
29-
while (source + sizeof(bc_simd_128_t) <= source_end) {
30-
bc_simd_128_t bytes = bc_simd_load_8x16((const bc_simd_128_t *) source);
31-
bytes = bc_simd_xor_8x16(bytes, shift_vector);
32-
bc_simd_store_8x16((bc_simd_128_t *) dest, bytes);
33-
34-
source += sizeof(bc_simd_128_t);
35-
dest += sizeof(bc_simd_128_t);
28+
__m128i shift_vector = _mm_set1_epi8('0');
29+
while (source + sizeof(__m128i) <= source_end) {
30+
__m128i bytes = _mm_loadu_si128((const __m128i *) source);
31+
bytes = _mm_xor_si128(bytes, shift_vector);
32+
_mm_storeu_si128((__m128i *) dest, bytes);
33+
34+
source += sizeof(__m128i);
35+
dest += sizeof(__m128i);
3636
}
3737
#endif
3838

0 commit comments

Comments
 (0)