From 6de10df8caabab184ae679d9422e2e823727293f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jukka=20Jyl=C3=A4nki?= Date: Fri, 19 Jun 2015 21:49:44 +0300 Subject: [PATCH] Implement (scalarized) support for SSE2 _mm_movemask_pd(). --- system/include/emscripten/emmintrin.h | 11 +++++++++-- tests/test_sse2_full.cpp | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/system/include/emscripten/emmintrin.h b/system/include/emscripten/emmintrin.h index 8c61ae6f8..4aed22253 100644 --- a/system/include/emscripten/emmintrin.h +++ b/system/include/emscripten/emmintrin.h @@ -1703,13 +1703,20 @@ _mm_unpacklo_pd(__m128d __a, __m128d __b) return __builtin_shufflevector(__a, __b, 0, 2+0); } -#ifndef __EMSCRIPTEN__ // XXX TODO Add support static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_movemask_pd(__m128d __a) { +#ifdef __EMSCRIPTEN__ + union { + unsigned long long x[2]; + __m128d m; + } src; + src.m = __a; + return (src.x[0] >> 63) | ((src.x[1] >> 63) << 1); +#else return __builtin_ia32_movmskpd(__a); -} #endif +} #define _mm_shuffle_pd(a, b, i) __extension__ ({ \ __builtin_shufflevector((__m128d)(a), (__m128d)(b), \ diff --git a/tests/test_sse2_full.cpp b/tests/test_sse2_full.cpp index fa82ed830..468ba671f 100644 --- a/tests/test_sse2_full.cpp +++ b/tests/test_sse2_full.cpp @@ -199,8 +199,8 @@ int main() // SSE2 Miscellaneous instructions: Ret_M128i(int, _mm_movemask_epi8); -#if 0 Ret_M128d(int, _mm_movemask_pd); +#if 0 M128i_M128i_M128i(_mm_packs_epi16); M128i_M128i_M128i(_mm_packs_epi32); M128i_M128i_M128i(_mm_packus_epi16);