aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-01-07 15:51:55 -0800
committerAlon Zakai <alonzakai@gmail.com>2014-01-07 15:51:55 -0800
commit3bb84257eac6bcf74e80dab5559fdc436773ccd6 (patch)
tree979379065fa9513de088a68ba36861d4b663759e
parent0b3416a1dcd808fb71043a9f400f3ef2aa636abc (diff)
update other.test_simd test for llvm 3.3 and 3.4
-rw-r--r--src/settings.js1
-rw-r--r--tests/test_other.py11
-rw-r--r--tools/shared.py2
3 files changed, 12 insertions, 2 deletions
diff --git a/src/settings.js b/src/settings.js
index 04b2cc79..720fb53f 100644
--- a/src/settings.js
+++ b/src/settings.js
@@ -123,6 +123,7 @@ var PRECISE_F32 = 0; // 0: Use JS numbers for floating-point values. These are 6
// 2: Model C++ floats precisely using Math.fround if available in the JS engine, otherwise
// use an empty polyfill. This will have less of a speed penalty than using the full
// polyfill in cases where engine support is not present.
+var SIMD = 0; // Whether to emit SIMD code ( https://github.com/johnmccutchan/ecmascript_simd )
var CLOSURE_ANNOTATIONS = 0; // If set, the generated code will be annotated for the closure
// compiler. This potentially lets closure optimize the code better.
diff --git a/tests/test_other.py b/tests/test_other.py
index f9ee2d9d..3f9bd93c 100644
--- a/tests/test_other.py
+++ b/tests/test_other.py
@@ -2152,8 +2152,17 @@ int main()
def test_simd(self):
if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp')
+ if get_clang_version() == '3.2':
+ simd_args = ['-O3', '-vectorize', '-vectorize-loops', '-bb-vectorize-vector-bits=128', '-force-vector-width=4']
+ elif get_clang_version() == '3.3':
+ simd_args = ['-O3', '-vectorize-loops', '-vectorize-slp', '-vectorize-slp-aggressive']
+ 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')
+
self.clear()
- Popen([PYTHON, EMCC, path_from_root('tests', 'linpack.c'), '-O2', '-DSP', '--llvm-opts', '''['-O3', '-vectorize', '-vectorize-loops', '-bb-vectorize-vector-bits=128', '-force-vector-width=4']''']).communicate()
+ Popen([PYTHON, EMCC, path_from_root('tests', 'linpack.c'), '-O2', '-s', 'SIMD=1', '-DSP', '--llvm-opts', str(simd_args)]).communicate()
self.assertContained('Unrolled Single Precision', run_js('a.out.js'))
def test_dependency_file(self):
diff --git a/tools/shared.py b/tools/shared.py
index 4ab476d3..eac4b658 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -1171,7 +1171,7 @@ class Building:
if type(opts) is int:
opts = Building.pick_llvm_opts(opts)
#opts += ['-debug-pass=Arguments']
- if get_clang_version() == '3.4':
+ 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
logging.debug('emcc: LLVM opts: ' + str(opts))
target = out or (filename + '.opt.bc')