Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(509)

Unified Diff: test/cctest/wasm/test-run-wasm-simd-lowering.cc

Issue 2294743003: [wasm] simd scalar lowering F32x4Add and I32x4Add (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: [wasm] simd scalar lowering F32x4Add and I32x4Add Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/cctest.gyp ('k') | test/cctest/wasm/wasm-run-utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/wasm/test-run-wasm-simd-lowering.cc
diff --git a/test/cctest/wasm/test-run-wasm-simd-lowering.cc b/test/cctest/wasm/test-run-wasm-simd-lowering.cc
new file mode 100644
index 0000000000000000000000000000000000000000..69e770b9b87350d5767a7638f18584f9fca952cd
--- /dev/null
+++ b/test/cctest/wasm/test-run-wasm-simd-lowering.cc
@@ -0,0 +1,96 @@
+// Copyright 2016 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "src/wasm/wasm-macro-gen.h"
+#include "src/wasm/wasm-module.h"
+
+#include "test/cctest/cctest.h"
+#include "test/cctest/compiler/value-helper.h"
+#include "test/cctest/wasm/wasm-run-utils.h"
+#include "test/common/wasm/test-signatures.h"
+
+using namespace v8::base;
+using namespace v8::internal;
+using namespace v8::internal::compiler;
+using namespace v8::internal::wasm;
+
+WASM_EXEC_TEST(Simd_I32x4_Splat) {
+ FLAG_wasm_simd_prototype = true;
+ WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32());
+ BUILD(r,
+ WASM_SIMD_I32x4_EXTRACT_LANE(0, WASM_SIMD_I32x4_SPLAT(WASM_I32V(5))));
+ FOR_INT32_INPUTS(i) { CHECK_EQ(5, r.Call()); }
+}
+
+WASM_EXEC_TEST(Simd_I32x4_Add) {
+ FLAG_wasm_simd_prototype = true;
+ WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32());
+ BUILD(r, WASM_SIMD_I32x4_EXTRACT_LANE(
+ 0, WASM_SIMD_I32x4_ADD(WASM_SIMD_I32x4_SPLAT(WASM_I32V(5)),
+ WASM_SIMD_I32x4_SPLAT(WASM_I32V(6)))));
+ FOR_INT32_INPUTS(i) { CHECK_EQ(11, r.Call()); }
+}
+
+WASM_EXEC_TEST(Simd_F32x4_Splat) {
+ FLAG_wasm_simd_prototype = true;
+ WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32());
+ BUILD(r,
+ WASM_IF_ELSE(WASM_F32_EQ(WASM_SIMD_F32x4_EXTRACT_LANE(
+ 0, WASM_SIMD_F32x4_SPLAT(WASM_F32(9.5))),
+ WASM_F32(9.5)),
+ WASM_RETURN1(WASM_I32V(1)), WASM_RETURN1(WASM_I32V(0))));
+ FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call()); }
+}
+
+WASM_EXEC_TEST(Simd_I32x4_Extract_With_F32x4) {
+ FLAG_wasm_simd_prototype = true;
+ WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32());
+ BUILD(r,
+ WASM_IF_ELSE(WASM_I32_EQ(WASM_SIMD_I32x4_EXTRACT_LANE(
+ 0, WASM_SIMD_F32x4_SPLAT(WASM_F32(30.5))),
+ WASM_I32_REINTERPRET_F32(WASM_F32(30.5))),
+ WASM_RETURN1(WASM_I32V(1)), WASM_RETURN1(WASM_I32V(0))));
+ FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call()); }
+}
+
+WASM_EXEC_TEST(Simd_F32x4_Extract_With_I32x4) {
+ FLAG_wasm_simd_prototype = true;
+ WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32());
+ BUILD(r,
+ WASM_IF_ELSE(WASM_F32_EQ(WASM_SIMD_F32x4_EXTRACT_LANE(
+ 0, WASM_SIMD_I32x4_SPLAT(WASM_I32V(15))),
+ WASM_F32_REINTERPRET_I32(WASM_I32V(15))),
+ WASM_RETURN1(WASM_I32V(1)), WASM_RETURN1(WASM_I32V(0))));
+ FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call()); }
+}
+
+WASM_EXEC_TEST(Simd_F32x4_Add_With_I32x4) {
+ FLAG_wasm_simd_prototype = true;
+ WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32());
+ BUILD(r,
+ WASM_IF_ELSE(
+ WASM_F32_EQ(WASM_SIMD_F32x4_EXTRACT_LANE(
+ 0, WASM_SIMD_F32x4_ADD(
+ WASM_SIMD_I32x4_SPLAT(WASM_I32V(32)),
+ WASM_SIMD_I32x4_SPLAT(WASM_I32V(19)))),
+ WASM_F32_ADD(WASM_F32_REINTERPRET_I32(WASM_I32V(32)),
+ WASM_F32_REINTERPRET_I32(WASM_I32V(19)))),
+ WASM_RETURN1(WASM_I32V(1)), WASM_RETURN1(WASM_I32V(0))));
+ FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call()); }
+}
+
+WASM_EXEC_TEST(Simd_I32x4_Add_With_F32x4) {
+ FLAG_wasm_simd_prototype = true;
+ WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32());
+ BUILD(r,
+ WASM_IF_ELSE(
+ WASM_I32_EQ(WASM_SIMD_I32x4_EXTRACT_LANE(
+ 0, WASM_SIMD_I32x4_ADD(
+ WASM_SIMD_F32x4_SPLAT(WASM_F32(21.25)),
+ WASM_SIMD_F32x4_SPLAT(WASM_F32(31.5)))),
+ WASM_I32_ADD(WASM_I32_REINTERPRET_F32(WASM_F32(21.25)),
+ WASM_I32_REINTERPRET_F32(WASM_F32(31.5)))),
+ WASM_RETURN1(WASM_I32V(1)), WASM_RETURN1(WASM_I32V(0))));
+ FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call()); }
+}
« no previous file with comments | « test/cctest/cctest.gyp ('k') | test/cctest/wasm/wasm-run-utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698