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

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

Issue 2728823005: [wasm] Implement simd lowering for F32x4 and I32x4 compare ops (Closed)
Patch Set: rebase Created 3 years, 10 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 | « src/compiler/wasm-compiler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/wasm/test-run-wasm-simd.cc
diff --git a/test/cctest/wasm/test-run-wasm-simd.cc b/test/cctest/wasm/test-run-wasm-simd.cc
index e2ec9e40928f26276f8ec72534ff234f883c7d60..a959e20121286b70ae2dba9650d67c46d1205035 100644
--- a/test/cctest/wasm/test-run-wasm-simd.cc
+++ b/test/cctest/wasm/test-run-wasm-simd.cc
@@ -28,12 +28,27 @@ typedef int8_t (*Int8UnOp)(int8_t);
typedef int8_t (*Int8BinOp)(int8_t, int8_t);
typedef int8_t (*Int8ShiftOp)(int8_t, int);
-#if V8_TARGET_ARCH_ARM
-// Floating point specific value functions, only used by ARM so far.
+#if !V8_TARGET_ARCH_ARM && !V8_TARGET_ARCH_X64
+#define SIMD_LOWERING_TARGET 1
+#else
+#define SIMD_LOWERING_TARGET 0
+#endif // !V8_TARGET_ARCH_ARM && !V8_TARGET_ARCH_X64
+
+#if V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET
int32_t Equal(float a, float b) { return a == b ? 1 : 0; }
int32_t NotEqual(float a, float b) { return a != b ? 1 : 0; }
-#endif // V8_TARGET_ARCH_ARM
+#endif // V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET
+
+#if SIMD_LOWERING_TARGET
+int32_t Less(float a, float b) { return a < b ? 1 : 0; }
+
+int32_t LessEqual(float a, float b) { return a <= b ? 1 : 0; }
+
+int32_t Greater(float a, float b) { return a > b ? 1 : 0; }
+
+int32_t GreaterEqual(float a, float b) { return a >= b ? 1 : 0; }
+#endif // SIMD_LOWERING_TARGET
// Generic expected value functions.
template <typename T>
@@ -224,12 +239,6 @@ T Sqrt(T a) {
} // namespace
-#if !V8_TARGET_ARCH_ARM && !V8_TARGET_ARCH_X64
-#define SIMD_LOWERING_TARGET 1
-#else
-#define SIMD_LOWERING_TARGET 0
-#endif // !V8_TARGET_ARCH_ARM && !V8_TARGET_ARCH_X64
-
#define WASM_SIMD_CHECK_LANE(TYPE, value, LANE_TYPE, lane_value, lane_index) \
WASM_IF(WASM_##LANE_TYPE##_NE(WASM_GET_LOCAL(lane_value), \
WASM_SIMD_##TYPE##_EXTRACT_LANE( \
@@ -492,7 +501,7 @@ WASM_EXEC_COMPILED_TEST(Simd_F32x4_Max) {
}
#endif // SIMD_LOWERING_TARGET
-#if V8_TARGET_ARCH_ARM
+#if V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET
void RunF32x4CompareOpTest(WasmOpcode simd_op, FloatCompareOp expected_op) {
FLAG_wasm_simd_prototype = true;
WasmRunner<int32_t, float, float, int32_t> r(kExecuteCompiled);
@@ -527,7 +536,22 @@ WASM_EXEC_COMPILED_TEST(F32x4Equal) {
WASM_EXEC_COMPILED_TEST(F32x4NotEqual) {
RunF32x4CompareOpTest(kExprF32x4Ne, NotEqual);
}
-#endif // V8_TARGET_ARCH_ARM
+#endif // V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET
+
+#if SIMD_LOWERING_TARGET
+WASM_EXEC_COMPILED_TEST(F32x4LessThan) {
+ RunF32x4CompareOpTest(kExprF32x4Lt, Less);
+}
+WASM_EXEC_COMPILED_TEST(F32x4LessThanOrEqual) {
+ RunF32x4CompareOpTest(kExprF32x4Le, LessEqual);
+}
+WASM_EXEC_COMPILED_TEST(F32x4GreaterThan) {
+ RunF32x4CompareOpTest(kExprF32x4Gt, Greater);
+}
+WASM_EXEC_COMPILED_TEST(F32x4GreaterThanOrEqual) {
+ RunF32x4CompareOpTest(kExprF32x4Ge, GreaterEqual);
+}
+#endif // SIMD_LOWERING_TARGET
WASM_EXEC_COMPILED_TEST(I32x4Splat) {
FLAG_wasm_simd_prototype = true;
@@ -894,9 +918,7 @@ WASM_EXEC_COMPILED_TEST(Ui32x4Min) {
WASM_EXEC_COMPILED_TEST(Ui32x4Max) {
RunI32x4BinOpTest(kExprI32x4MaxU, UnsignedMaximum);
}
-#endif // V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET
-#if V8_TARGET_ARCH_ARM
void RunI32x4CompareOpTest(WasmOpcode simd_op, Int32BinOp expected_op) {
FLAG_wasm_simd_prototype = true;
WasmRunner<int32_t, int32_t, int32_t, int32_t> r(kExecuteCompiled);
@@ -957,9 +979,7 @@ WASM_EXEC_COMPILED_TEST(Ui32x4Less) {
WASM_EXEC_COMPILED_TEST(Ui32x4LessEqual) {
RunI32x4CompareOpTest(kExprI32x4LeU, UnsignedLessEqual);
}
-#endif // V8_TARGET_ARCH_ARM
-#if V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET
void RunI32x4ShiftOpTest(WasmOpcode simd_op, Int32ShiftOp expected_op,
int shift) {
FLAG_wasm_simd_prototype = true;
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698