Path: blob/main/system/include/compat/pmmintrin.h
6171 views
/*1* Copyright 2020 The Emscripten Authors. All rights reserved.2* Emscripten is available under two separate licenses, the MIT license and the3* University of Illinois/NCSA Open Source License. Both these licenses can be4* found in the LICENSE file.5*/6#ifndef __emscripten_pmmintrin_h__7#define __emscripten_pmmintrin_h__89#ifndef __SSE3__10#error "SSE3 instruction set not enabled"11#endif1213#include <emmintrin.h>1415static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))16_mm_lddqu_si128(__m128i const *__p)17{18return _mm_loadu_si128(__p);19}2021static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))22_mm_addsub_ps(__m128 __a, __m128 __b)23{24return _mm_add_ps(__a, _mm_mul_ps(__b, _mm_set_ps(1.f, -1.f, 1.f, -1.f)));25}2627static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))28_mm_hadd_ps(__m128 __a, __m128 __b)29{30return _mm_add_ps(_mm_shuffle_ps(__a, __b, _MM_SHUFFLE(2, 0, 2, 0)), _mm_shuffle_ps(__a, __b, _MM_SHUFFLE(3, 1, 3, 1)));31}3233static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))34_mm_hsub_ps(__m128 __a, __m128 __b)35{36return _mm_sub_ps(_mm_shuffle_ps(__a, __b, _MM_SHUFFLE(2, 0, 2, 0)), _mm_shuffle_ps(__a, __b, _MM_SHUFFLE(3, 1, 3, 1)));37}3839static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))40_mm_movehdup_ps(__m128 __a)41{42return (__m128)wasm_i32x4_shuffle(__a, __a, 1, 1, 3, 3);43}4445static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))46_mm_moveldup_ps(__m128 __a)47{48return (__m128)wasm_i32x4_shuffle(__a, __a, 0, 0, 2, 2);49}5051static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))52_mm_addsub_pd(__m128d __a, __m128d __b)53{54return _mm_add_pd(__a, _mm_mul_pd(__b, _mm_set_pd(1.0, -1.0)));55}5657static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))58_mm_hadd_pd(__m128d __a, __m128d __b)59{60return _mm_add_pd(_mm_shuffle_pd(__a, __b, _MM_SHUFFLE2(0, 0)), _mm_shuffle_pd(__a, __b, _MM_SHUFFLE2(1, 1)));61}6263static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))64_mm_hsub_pd(__m128d __a, __m128d __b)65{66return _mm_sub_pd(_mm_shuffle_pd(__a, __b, _MM_SHUFFLE2(0, 0)), _mm_shuffle_pd(__a, __b, _MM_SHUFFLE2(1, 1)));67}6869#define _mm_loaddup_pd(dp) _mm_load1_pd(dp)7071static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))72_mm_movedup_pd(__m128d __a)73{74return (__m128d)wasm_i64x2_shuffle(__a, __a, 0, 0);75}7677#define _MM_DENORMALS_ZERO_ON (0x0040)78#define _MM_DENORMALS_ZERO_OFF (0x0000)79#define _MM_DENORMALS_ZERO_MASK (0x0040)80#define _MM_GET_DENORMALS_ZERO_MODE() (_mm_getcsr() & _MM_DENORMALS_ZERO_MASK)8182// Unavailable functions:83// #define _MM_SET_DENORMALS_ZERO_MODE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_DENORMALS_ZERO_MASK) | (x)))84// void _mm_monitor(void const *__p, unsigned __extensions, unsigned __hints);85// void _mm_mwait(unsigned __extensions, unsigned __hints);8687#endif /* __emscripten_pmmintrin_h__ */888990