This commit is contained in:
Alon Zakai 2014-11-18 12:59:58 -08:00
Родитель 8a70c782a3
Коммит 308d916b9d
7 изменённых файлов: 27 добавлений и 46 удалений

3
emcc
Просмотреть файл

@ -912,6 +912,9 @@ try:
fastcomp_opts += ['-emscripten-asyncify-functions=' + ','.join(shared.Settings.ASYNCIFY_FUNCTIONS)]
fastcomp_opts += ['-emscripten-asyncify-whitelist=' + ','.join(shared.Settings.ASYNCIFY_WHITELIST)]
else: # non-fastcomp
logging.warning('Using old (non-fastcomp) compiler due to EMCC_FAST_COMPILER=0 in the env. This is dangerous, as there are known bugs, and this code path is no longer maintained. Please use emscripten in the default configuration (i.e., do not disable fastcomp)')
if shared.Settings.ASM_JS:
assert opt_level >= 1 or fastcomp, 'asm.js requires -O1 or above'

Просмотреть файл

@ -1,2 +1,2 @@
1.26.1
1.27.1

Просмотреть файл

@ -1104,7 +1104,7 @@ def emscript_fast(infile, settings, outfile, libraries=[], compiler_engine=None,
'splat', 'swizzle', 'shuffle',
'withX', 'withY', 'withZ', 'withW',
'load', 'store']
simdfloatfuncs = simdfuncs + ['mul', 'div', 'min', 'max', 'sqrt',
simdfloatfuncs = simdfuncs + ['mul', 'div', 'min', 'max', 'sqrt', 'neg',
'fromInt32x4', 'fromInt32x4Bits',
'notEqual', 'lessThanOrEqual', 'greaterThanOrEqual'];
simdintfuncs = simdfuncs + ['fromFloat32x4', 'fromFloat32x4Bits'];

Просмотреть файл

@ -4970,20 +4970,11 @@ int main(void) {
def test_fannkuch(self):
if Settings.USE_TYPED_ARRAYS != 2: return self.skip('musl libc needs ta2')
try:
if self.run_name == 'slow2' or self.run_name == 'slow2asm':
old_target = os.environ.get('EMCC_LLVM_TARGET') or ''
os.environ['EMCC_LLVM_TARGET'] = "asmjs-unknown-emscripten" # testing for asm-emscripten target on non-fastcomp
if os.environ.get('EMCC_FAST_COMPILER') == '0': return self.skip('needs fastcomp')
results = [ (1,0), (2,1), (3,2), (4,4), (5,7), (6,10), (7, 16), (8,22) ]
for i, j in results:
src = open(path_from_root('tests', 'fannkuch.cpp'), 'r').read()
self.do_run(src, 'Pfannkuchen(%d) = %d.' % (i,j), [str(i)], no_build=i>1)
finally:
if self.run_name == 'slow2' or self.run_name == 'slow2asm':
if old_target:
os.environ['EMCC_LLVM_TARGET'] = old_target
else:
del os.environ['EMCC_LLVM_TARGET']
def test_raytrace(self):
if self.emcc_args is None: return self.skip('requires emcc')
@ -5359,6 +5350,7 @@ def process(filename):
# gcc -O3 -I/home/alon/Dev/emscripten/tests/sqlite -ldl src.c
if self.emcc_args is None: return self.skip('Very slow without ta2, and we would also need to include dlmalloc manually without emcc')
if not self.is_emscripten_abi(): return self.skip('fails on x86 due to a legalization issue on llvm 3.3')
if os.environ.get('EMCC_FAST_COMPILER') == '0': return self.skip('requires fastcomp')
if Settings.QUANTUM_SIZE == 1: return self.skip('TODO FIXME')
self.banned_js_engines = [NODE_JS] # OOM in older node
if '-O' not in str(self.emcc_args):
@ -5746,7 +5738,10 @@ def process(filename):
'18.cpp', '15.c', '21.c'
]: continue # works only in fastcomp
if x == 'lto' and self.run_name == 'default' and os.path.basename(name) in [
'19.c'
'19.c', '18.cpp'
]: continue # LLVM LTO bug
if x == 'lto' and os.path.basename(name) in [
'21.c'
]: continue # LLVM LTO bug
print name
@ -6777,6 +6772,7 @@ def process(filename):
if Settings.USE_TYPED_ARRAYS != 2: return self.skip("doesn't pass without typed arrays")
if '-g4' not in Building.COMPILER_TEST_OPTS: Building.COMPILER_TEST_OPTS.append('-g4')
if NODE_JS not in JS_ENGINES: return self.skip('sourcemapper requires Node to run')
if os.environ.get('EMCC_FAST_COMPILER') == '0': return self.skip('requires fastcomp')
src = '''
#include <stdio.h>

Просмотреть файл

@ -2374,19 +2374,8 @@ int main()
self.assertContained('File size: 724', out)
def test_simd(self):
if get_clang_version() == '3.2':
simd_args = ['-O3', '-vectorize', '-vectorize-loops']
elif get_clang_version() == '3.3':
simd_args = ['-O3', '-vectorize-loops', '-vectorize-slp-aggressive', '-bb-vectorize-aligned-only'] # XXX this generates <2 x float> , '-vectorize-slp']
elif get_clang_version() == '3.4':
simd_args = ['-O3'] # vectorization on by default, SIMD=1 makes us not disable it
else:
raise Exception('unknown llvm version')
simd_args += ['-bb-vectorize-vector-bits=128', '-force-vector-width=4']
self.clear()
Popen([PYTHON, EMCC, path_from_root('tests', 'linpack.c'), '-O2', '-s', 'SIMD=1', '-DSP', '--llvm-opts', str(simd_args), '-s', 'PRECISE_F32=1']).communicate()
assert get_clang_version() == '3.4'
Popen([PYTHON, EMCC, path_from_root('tests', 'linpack.c'), '-O2', '-s', 'SIMD=1', '-DSP', '-s', 'PRECISE_F32=1']).communicate()
self.assertContained('Unrolled Single Precision', run_js('a.out.js'))
def test_dependency_file(self):
@ -2612,7 +2601,7 @@ int main(int argc, char **argv) {
exit = 1-no_exit
assert 'coming around' in output
assert ('going away' in output) == exit, 'destructors should not run if no exit'
assert ('_ZN5WasteILi2EED1Ev' in src) == exit, 'destructors should not appear if no exit'
assert ('_ZN5WasteILi2EED' in src) == exit, 'destructors should not appear if no exit'
assert ('atexit(' in src) == exit, 'atexit should not appear or be called'
def test_os_oz(self):
@ -3529,7 +3518,7 @@ main()
''')
Popen([PYTHON, EMCC, 'src.cpp', '-O2', '-s', 'SAFE_HEAP=1']).communicate()
assert os.path.exists('a.out.js') # build should succeed
self.assertContained('segmentation fault loading 4 bytes from address 0', run_js('a.out.js', assert_returncode=None, stderr=PIPE)) # program should segfault
self.assertContained(('trap!', 'segmentation fault loading 4 bytes from address 0'), run_js('a.out.js', assert_returncode=None, stderr=PIPE)) # program should segfault
def test_only_force_stdlibs(self):
def test(name):

Просмотреть файл

@ -450,17 +450,6 @@ fi
assert os.stat(os.path.join(EMCC_CACHE, libname + '.bc')).st_size > 1000000, 'libc++ is big'
assert os.stat(basebc_name).st_size > 1000000, 'libc++ is indeed big'
assert os.stat(dcebc_name).st_size < os.stat(basebc_name).st_size*0.666, 'Dead code elimination must remove most of libc++'
# should only have metadata in -O0, not 1 and 2
if i > 0:
ll = None
for ll_name in ll_names:
if os.path.exists(ll_name):
check_call([LLVM_DIS, ll_name, '-o', ll_name + '.ll'])
ll = open(ll_name + '.ll').read()
break
assert ll
print 'metas:', ll.count('\n!')
assert ll.count('\n!') < 25 # a few lines are left even in -O1 and -O2
finally:
del os.environ['EMCC_DEBUG']

Просмотреть файл

@ -294,7 +294,7 @@ if EM_POPEN_WORKAROUND and os.name == 'nt':
# Expectations
EXPECTED_LLVM_VERSION = (3,3)
EXPECTED_LLVM_VERSION = (3,4)
actual_clang_version = None
@ -1385,8 +1385,12 @@ class Building:
if type(opts) is int:
opts = Building.pick_llvm_opts(opts)
#opts += ['-debug-pass=Arguments']
if get_clang_version() == '3.4' and not Settings.SIMD:
opts += ['-disable-loop-vectorization', '-disable-slp-vectorization'] # llvm 3.4 has these on by default
if get_clang_version() >= '3.4':
if not Settings.SIMD:
opts += ['-disable-vectorize']
else:
opts += ['-bb-vectorize-vector-bits=128', '-force-vector-width=4']
logging.debug('emcc: LLVM opts: ' + ' '.join(opts))
target = out or (filename + '.opt.bc')
output = Popen([LLVM_OPT, filename] + opts + ['-o', target], stdout=PIPE).communicate()[0]