Add proper support for -msse and -msse2 build flags. Don't emit SSE2 code unless explicitly enabled, since it is not implemented in Firefox and does not validate.
This commit is contained in:
Родитель
c30c754e60
Коммит
25391d8a3e
12
emcc
12
emcc
|
@ -415,6 +415,8 @@ try:
|
|||
proxy_to_worker = False
|
||||
default_object_extension = '.o'
|
||||
valid_abspaths = []
|
||||
sse1 = False
|
||||
sse2 = False
|
||||
|
||||
def is_valid_abspath(path_name):
|
||||
# Any path that is underneath the emscripten repository root must be ok.
|
||||
|
@ -662,6 +664,16 @@ try:
|
|||
if not default_object_extension.startswith('.'):
|
||||
default_object_extension = '.' + default_object_extension
|
||||
newargs[i+1] = ''
|
||||
elif newargs[i] == '-msse':
|
||||
settings_changes.append('SSE1=1')
|
||||
newargs.append('-D__SSE__=1')
|
||||
newargs[i] = ''
|
||||
elif newargs[i] == '-msse2':
|
||||
settings_changes.append('SSE1=1')
|
||||
settings_changes.append('SSE2=1')
|
||||
newargs.append('-D__SSE__=1')
|
||||
newargs.append('-D__SSE2__=1')
|
||||
newargs[i] = ''
|
||||
|
||||
if should_exit:
|
||||
sys.exit(0)
|
||||
|
|
|
@ -450,8 +450,14 @@ function _emscripten_asm_const_%d(%s) {
|
|||
asm_setup += '\nvar debug_table_' + sig + ' = ' + json.dumps(debug_tables[sig]) + ';'
|
||||
|
||||
maths = ['Math.' + func for func in ['floor', 'abs', 'sqrt', 'pow', 'cos', 'sin', 'tan', 'acos', 'asin', 'atan', 'atan2', 'exp', 'log', 'ceil', 'imul', 'min', 'clz32']]
|
||||
simdfloattypes = ['Float32x4', 'Float64x2']
|
||||
simdinttypes = ['Int8x16', 'Int16x8', 'Int32x4']
|
||||
simdfloattypes = []
|
||||
simdinttypes = []
|
||||
|
||||
if settings['SSE1'] or settings['SIMD']:
|
||||
simdfloattypes += ['Float32x4']
|
||||
if settings['SSE2'] or settings['SIMD']:
|
||||
simdfloattypes += ['Float64x2']
|
||||
simdinttypes = ['Int8x16', 'Int16x8', 'Int32x4']
|
||||
simdtypes = simdfloattypes + simdinttypes
|
||||
simdfuncs = ['check', 'add', 'sub', 'neg', 'mul',
|
||||
'equal', 'lessThan', 'greaterThan',
|
||||
|
@ -479,7 +485,7 @@ function _emscripten_asm_const_%d(%s) {
|
|||
if settings['ALLOW_MEMORY_GROWTH']: fundamentals.append('byteLength')
|
||||
math_envs = []
|
||||
|
||||
provide_fround = settings['PRECISE_F32'] or settings['SIMD']
|
||||
provide_fround = settings['PRECISE_F32'] or settings['SIMD'] or settings['SSE1']
|
||||
|
||||
if provide_fround: maths += ['Math.fround']
|
||||
|
||||
|
|
|
@ -120,6 +120,9 @@ var SIMD = 0; // Whether to allow autovectorized SIMD code ( https://github.com/
|
|||
// (In older versions of emscripten, in particular pre-fastcomp, SIMD=1 was needed to get
|
||||
// any SIMD output at all.)
|
||||
|
||||
var SSE1 = 0; // If true, enables generating code to target the SSE1 instruction set. Build with -msse to enable this.
|
||||
var SSE2 = 0; // If true, enables generating code to target the SSE2 instruction set. Build with -msse2 to enable this.
|
||||
|
||||
var USE_CLOSURE_COMPILER = 0; // Whether closure compiling is being run on this output
|
||||
|
||||
var SKIP_STACK_IN_SMALL = 1; // When enabled, does not push/pop the stack at all in
|
||||
|
|
|
@ -43,14 +43,12 @@
|
|||
#define _mm_cvttsd_si64x _mm_cvttsd_si64
|
||||
#define _mm_store_pd1 _mm_store1_pd
|
||||
|
||||
#else
|
||||
#endif
|
||||
|
||||
#ifndef __SSE2__
|
||||
#error "SSE2 instruction set not enabled"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#include <xmmintrin.h>
|
||||
|
||||
typedef double __m128d __attribute__((__vector_size__(16)));
|
||||
|
|
|
@ -6,6 +6,10 @@
|
|||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifndef __SSE__
|
||||
#error "SSE instruction set not enabled"
|
||||
#endif
|
||||
|
||||
// Emscripten SIMD support doesn't support MMX/float32x2/__m64.
|
||||
// However, we support loading and storing 2-vectors, so
|
||||
// treat "__m64 *" as "void *" for that purpose.
|
||||
|
|
Загрузка…
Ссылка в новой задаче