Skip to content

Commit 128c77a

Browse files
committed
bthread: fix simd memory align issue
1 parent 0e7c644 commit 128c77a

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/bthread/task_group.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ AtomicInteger128::Value AtomicInteger128::load() const {
9494

9595
#if __x86_64__ || __ARM_NEON
9696
#ifdef __x86_64__
97-
__m128i value = _mm_load_si128(reinterpret_cast<const __m128i*>(&_value));
97+
__m128i value = _mm_loadu_si128(reinterpret_cast<const __m128i*>(&_value));
9898
#else // __ARM_NEON
9999
int64x2_t value = vld1q_s64(reinterpret_cast<const int64_t*>(&_value));
100100
#endif // __x86_64__
@@ -107,8 +107,8 @@ AtomicInteger128::Value AtomicInteger128::load() const {
107107

108108
void AtomicInteger128::store(Value value) {
109109
#if __x86_64__
110-
__m128i v = _mm_load_si128(reinterpret_cast<__m128i*>(&value));
111-
_mm_store_si128(reinterpret_cast<__m128i*>(&_value), v);
110+
__m128i v = _mm_loadu_si128(reinterpret_cast<__m128i*>(&value));
111+
_mm_storeu_si128(reinterpret_cast<__m128i*>(&_value), v);
112112
#elif __ARM_NEON
113113
int64x2_t v = vld1q_s64(reinterpret_cast<int64_t*>(&value));
114114
vst1q_s64(reinterpret_cast<int64_t*>(&_value), v);

0 commit comments

Comments
 (0)