Skip to content

Commit dec8fa0

Browse files
walkingeyerobotfarindk
authored andcommitted
add emscripten support for simd
1 parent 5596fb2 commit dec8fa0

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

libde265/x86/sse.cc

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#include "config.h"
3131
#endif
3232

33-
#ifdef __GNUC__
33+
#if defined(__GNUC__) && !defined(__EMSCRIPTEN__)
3434
#include <cpuid.h>
3535
#endif
3636

@@ -46,11 +46,21 @@ void init_acceleration_functions_sse(struct acceleration_functions* accel)
4646

4747
ecx = regs[2];
4848
edx = regs[3];
49-
#else
49+
#elif !defined(__EMSCRIPTEN__)
5050
uint32_t eax,ebx;
5151
__get_cpuid(1, &eax,&ebx,&ecx,&edx);
5252
#endif
53-
53+
54+
#ifdef __EMSCRIPTEN__
55+
int have_SSE = 0;
56+
int have_SSE4_1 = 0;
57+
#ifdef __SSE__
58+
have_SSE = 1;
59+
#endif
60+
#ifdef __SSE4_1__
61+
have_SSE4_1 = 1;
62+
#endif
63+
#else
5464
// printf("CPUID EAX=1 -> ECX=%x EDX=%x\n", regs[2], regs[3]);
5565

5666
//int have_MMX = !!(edx & (1<<23));
@@ -61,6 +71,7 @@ void init_acceleration_functions_sse(struct acceleration_functions* accel)
6171

6272
if (have_SSE) {
6373
}
74+
#endif
6475

6576
#if HAVE_SSE4_1
6677
if (have_SSE4_1) {

0 commit comments

Comments
 (0)