From 5633d1eaf99a1bdeeb4eb901c38bec1eff46a631 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jukka=20Jyl=C3=A4nki?= Date: Sat, 20 Jun 2015 19:05:06 +0300 Subject: [PATCH] Add new SIMD test for asm.js validation with splat() instruction. --- tests/core/test_simd9.in | 11 +++++++++++ tests/core/test_simd9.out | 1 + tests/test_core.py | 10 ++++++++++ 3 files changed, 22 insertions(+) create mode 100644 tests/core/test_simd9.in create mode 100644 tests/core/test_simd9.out diff --git a/tests/core/test_simd9.in b/tests/core/test_simd9.in new file mode 100644 index 000000000..2e3efd638 --- /dev/null +++ b/tests/core/test_simd9.in @@ -0,0 +1,11 @@ +#include +#include +#include + +bool always_true() { return time(NULL) != 0; } // This function always returns true, but the compiler should not know this. + +int main() +{ + __m128 a = always_true() ? _mm_set1_ps(0.f) : _mm_set1_ps(2.f); + printf("%d %d %d %d\n", (int)a[0], (int)a[1], (int)a[2], (int)a[3]); +} diff --git a/tests/core/test_simd9.out b/tests/core/test_simd9.out new file mode 100644 index 000000000..7abb2cab3 --- /dev/null +++ b/tests/core/test_simd9.out @@ -0,0 +1 @@ +0 0 0 0 \ No newline at end of file diff --git a/tests/test_core.py b/tests/test_core.py index b494fb484..26cd38746 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -5652,6 +5652,16 @@ return malloc(size); self.do_run_from_file(src, output) + def test_simd9(self): + # test_simd9 is to test a bug where _mm_set_ps(0.f) would generate an expression that did not validate as asm.js + if self.is_emterpreter(): return self.skip('todo') + + test_path = path_from_root('tests', 'core', 'test_simd9') + src, output = (test_path + s for s in ('.in', '.out')) + + self.emcc_args = self.emcc_args + ['-msse'] + self.do_run_from_file(src, output) + def test_simd_dyncall(self): if self.is_emterpreter(): return self.skip('todo')