Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 22c505a

Browse files
committedApr 29, 2025
fixed _mm_srli_si128 and _mm_slli_si128
1 parent d00d75d commit 22c505a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed
 

‎Zend/zend_simd.h

+7-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,13 @@ typedef int8x16_t __m128i;
4747
#define _mm_or_si128(a, b) vorrq_s8(a, b)
4848
#define _mm_xor_si128(a, b) veorq_s8(a, b)
4949
#define _mm_and_si128(a, b) vandq_s8(a, b)
50-
#define _mm_srli_si128(x, bytes) vreinterpretq_s8_u8(vextq_u8(vdupq_n_u8(0), vreinterpretq_u8_s8(x), bytes))
51-
#define _mm_slli_si128(x, bytes) vreinterpretq_s8_u8(vextq_u8(vreinterpretq_u8_s8(x), vdupq_n_u8(0), 16 - bytes))
50+
51+
#define _mm_slli_si128(x, imm) \
52+
((imm) >= 16 ? vdupq_n_s8(0) : \
53+
vreinterpretq_s8_u8(vextq_u8(vdupq_n_u8(0), vreinterpretq_u8_s8(x), 16 - (imm))))
54+
#define _mm_srli_si128(x, imm) \
55+
((imm) >= 16 ? vdupq_n_s8(0) : \
56+
vreinterpretq_s8_u8(vextq_u8(vreinterpretq_u8_s8(x), vdupq_n_u8(0), (imm))))
5257

5358
#define _mm_add_epi8(a, b) vaddq_s8(a, b)
5459

0 commit comments

Comments
 (0)
Please sign in to comment.