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

Side by Side Diff: test/cctest/wasm/test-run-wasm-simd.cc

Issue 2861113002: [wasm] Add simd lowering for I16x8Neg (Closed)
Patch Set: Enable I16x8Neg test for SIMD_LOWERING_TARGET Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « src/compiler/simd-scalar-lowering.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/assembler-inl.h" 5 #include "src/assembler-inl.h"
6 #include "test/cctest/cctest.h" 6 #include "test/cctest/cctest.h"
7 #include "test/cctest/compiler/value-helper.h" 7 #include "test/cctest/compiler/value-helper.h"
8 #include "test/cctest/wasm/wasm-run-utils.h" 8 #include "test/cctest/wasm/wasm-run-utils.h"
9 #include "test/common/wasm/wasm-macro-gen.h" 9 #include "test/common/wasm/wasm-macro-gen.h"
10 10
(...skipping 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 WASM_SIMD_CHECK_SPLAT8(I16x8, simd2, I32, unpacked_unsigned), WASM_ONE); 1152 WASM_SIMD_CHECK_SPLAT8(I16x8, simd2, I32, unpacked_unsigned), WASM_ONE);
1153 1153
1154 FOR_INT8_INPUTS(i) { 1154 FOR_INT8_INPUTS(i) {
1155 int32_t unpacked_signed = Widen<int8_t>(*i); 1155 int32_t unpacked_signed = Widen<int8_t>(*i);
1156 int32_t unpacked_unsigned = UnsignedWiden<int8_t>(*i); 1156 int32_t unpacked_unsigned = UnsignedWiden<int8_t>(*i);
1157 CHECK_EQ(1, r.Call(*i, unpacked_signed, unpacked_unsigned)); 1157 CHECK_EQ(1, r.Call(*i, unpacked_signed, unpacked_unsigned));
1158 } 1158 }
1159 } 1159 }
1160 #endif // V8_TARGET_ARCH_ARM 1160 #endif // V8_TARGET_ARCH_ARM
1161 1161
1162 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 1162 #if SIMD_LOWERING_TARGET || V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS || \
1163 V8_TARGET_ARCH_MIPS64
1163 void RunI16x8UnOpTest(WasmOpcode simd_op, Int16UnOp expected_op) { 1164 void RunI16x8UnOpTest(WasmOpcode simd_op, Int16UnOp expected_op) {
1164 FLAG_wasm_simd_prototype = true; 1165 FLAG_wasm_simd_prototype = true;
1165 WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled); 1166 WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled);
1166 byte a = 0; 1167 byte a = 0;
1167 byte expected = 1; 1168 byte expected = 1;
1168 byte simd = r.AllocateLocal(kWasmS128); 1169 byte simd = r.AllocateLocal(kWasmS128);
1169 BUILD(r, WASM_SET_LOCAL(simd, WASM_SIMD_I16x8_SPLAT(WASM_GET_LOCAL(a))), 1170 BUILD(r, WASM_SET_LOCAL(simd, WASM_SIMD_I16x8_SPLAT(WASM_GET_LOCAL(a))),
1170 WASM_SET_LOCAL(simd, WASM_SIMD_UNOP(simd_op, WASM_GET_LOCAL(simd))), 1171 WASM_SET_LOCAL(simd, WASM_SIMD_UNOP(simd_op, WASM_GET_LOCAL(simd))),
1171 WASM_SIMD_CHECK_SPLAT8(I16x8, simd, I32, expected), WASM_ONE); 1172 WASM_SIMD_CHECK_SPLAT8(I16x8, simd, I32, expected), WASM_ONE);
1172 1173
1173 FOR_INT16_INPUTS(i) { CHECK_EQ(1, r.Call(*i, expected_op(*i))); } 1174 FOR_INT16_INPUTS(i) { CHECK_EQ(1, r.Call(*i, expected_op(*i))); }
1174 } 1175 }
1175 1176
1176 WASM_EXEC_COMPILED_TEST(I16x8Neg) { RunI16x8UnOpTest(kExprI16x8Neg, Negate); } 1177 WASM_EXEC_COMPILED_TEST(I16x8Neg) { RunI16x8UnOpTest(kExprI16x8Neg, Negate); }
1177 #endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 1178 #endif // SIMD_LOWERING_TARGET || V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS ||
1179 // V8_TARGET_ARCH_MIPS64
1178 1180
1179 #if V8_TARGET_ARCH_ARM 1181 #if V8_TARGET_ARCH_ARM
1180 // Tests both signed and unsigned conversion from I32x4 (packing). 1182 // Tests both signed and unsigned conversion from I32x4 (packing).
1181 WASM_EXEC_COMPILED_TEST(I16x8ConvertI32x4) { 1183 WASM_EXEC_COMPILED_TEST(I16x8ConvertI32x4) {
1182 FLAG_wasm_simd_prototype = true; 1184 FLAG_wasm_simd_prototype = true;
1183 WasmRunner<int32_t, int32_t, int32_t, int32_t> r(kExecuteCompiled); 1185 WasmRunner<int32_t, int32_t, int32_t, int32_t> r(kExecuteCompiled);
1184 byte a = 0; 1186 byte a = 0;
1185 byte packed_signed = 1; 1187 byte packed_signed = 1;
1186 byte packed_unsigned = 2; 1188 byte packed_unsigned = 2;
1187 byte simd0 = r.AllocateLocal(kWasmS128); 1189 byte simd0 = r.AllocateLocal(kWasmS128);
(...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after
2278 WASM_SIMD_I32x4_EXTRACT_LANE( 2280 WASM_SIMD_I32x4_EXTRACT_LANE(
2279 0, WASM_LOAD_MEM(MachineType::Simd128(), WASM_ZERO))); 2281 0, WASM_LOAD_MEM(MachineType::Simd128(), WASM_ZERO)));
2280 2282
2281 FOR_INT32_INPUTS(i) { 2283 FOR_INT32_INPUTS(i) {
2282 int32_t expected = *i; 2284 int32_t expected = *i;
2283 r.module().WriteMemory(&memory[0], expected); 2285 r.module().WriteMemory(&memory[0], expected);
2284 CHECK_EQ(expected, r.Call()); 2286 CHECK_EQ(expected, r.Call());
2285 } 2287 }
2286 } 2288 }
2287 #endif // V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET || V8_TARGET_ARCH_X64 2289 #endif // V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET || V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/compiler/simd-scalar-lowering.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698