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

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: 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
« src/compiler/wasm-compiler.cc ('K') | « 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 b634f3853fe45e3ad6a199fa8aade7622dd3ee27..a7fbb4bfc371e586be06e8b8abb5e4bad9ddbbb6 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>
@@ -219,12 +234,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( \
@@ -487,7 +496,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);
@@ -522,7 +531,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;
@@ -889,9 +913,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);
@@ -952,9 +974,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;
« src/compiler/wasm-compiler.cc ('K') | « src/compiler/wasm-compiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698