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

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

Issue 1655883002: [wasm] Initial commit for the Int64Reducer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Initialize replacement array Created 4 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 unified diff | Download patch
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | test/cctest/wasm/wasm-run-utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 <stdint.h> 5 #include <stdint.h>
6 #include <stdlib.h> 6 #include <stdlib.h>
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "src/wasm/wasm-macro-gen.h" 9 #include "src/wasm/wasm-macro-gen.h"
10 10
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 WasmRunner<int64_t> r; 109 WasmRunner<int64_t> r;
110 const int64_t kExpectedValue = (static_cast<int64_t>(*i) << 32) | cntr; 110 const int64_t kExpectedValue = (static_cast<int64_t>(*i) << 32) | cntr;
111 // return(kExpectedValue) 111 // return(kExpectedValue)
112 BUILD(r, WASM_I64(kExpectedValue)); 112 BUILD(r, WASM_I64(kExpectedValue));
113 CHECK_EQ(kExpectedValue, r.Call()); 113 CHECK_EQ(kExpectedValue, r.Call());
114 cntr++; 114 cntr++;
115 } 115 }
116 } 116 }
117 #endif 117 #endif
118 118
119 TEST(Run_WasmI32ConvertI64) {
120 FOR_INT64_INPUTS(i) {
121 WasmRunner<int32_t> r;
122 BUILD(r, WASM_I32_CONVERT_I64(WASM_I64(*i)));
123 CHECK_EQ(static_cast<int32_t>(*i), r.Call());
124 }
125 }
126
127 TEST(Run_WasmI64AndConstants) {
128 FOR_INT64_INPUTS(i) {
129 FOR_INT64_INPUTS(j) {
130 WasmRunner<int32_t> r;
131 BUILD(r, WASM_I32_CONVERT_I64(WASM_I64_AND(WASM_I64(*i), WASM_I64(*j))));
132 CHECK_EQ(static_cast<int32_t>(*i & *j), r.Call());
133 }
134 }
135 }
119 136
120 TEST(Run_WasmInt32Param0) { 137 TEST(Run_WasmInt32Param0) {
121 WasmRunner<int32_t> r(MachineType::Int32()); 138 WasmRunner<int32_t> r(MachineType::Int32());
122 // return(local[0]) 139 // return(local[0])
123 BUILD(r, WASM_GET_LOCAL(0)); 140 BUILD(r, WASM_GET_LOCAL(0));
124 FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } 141 FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
125 } 142 }
126 143
127 144
128 TEST(Run_WasmInt32Param0_fallthru) { 145 TEST(Run_WasmInt32Param0_fallthru) {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 CHECK_EQ(expected, r.Call()); 226 CHECK_EQ(expected, r.Call());
210 } 227 }
211 { 228 {
212 WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); 229 WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32());
213 // a op b 230 // a op b
214 BUILD(r, WASM_BINOP(opcode, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); 231 BUILD(r, WASM_BINOP(opcode, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
215 CHECK_EQ(expected, r.Call(a, b)); 232 CHECK_EQ(expected, r.Call(a, b));
216 } 233 }
217 } 234 }
218 235
219
220 TEST(Run_WasmInt32Binops) { 236 TEST(Run_WasmInt32Binops) {
221 TestInt32Binop(kExprI32Add, 88888888, 33333333, 55555555); 237 TestInt32Binop(kExprI32Add, 88888888, 33333333, 55555555);
222 TestInt32Binop(kExprI32Sub, -1111111, 7777777, 8888888); 238 TestInt32Binop(kExprI32Sub, -1111111, 7777777, 8888888);
223 TestInt32Binop(kExprI32Mul, 65130756, 88734, 734); 239 TestInt32Binop(kExprI32Mul, 65130756, 88734, 734);
224 TestInt32Binop(kExprI32DivS, -66, -4777344, 72384); 240 TestInt32Binop(kExprI32DivS, -66, -4777344, 72384);
225 TestInt32Binop(kExprI32DivU, 805306368, 0xF0000000, 5); 241 TestInt32Binop(kExprI32DivU, 805306368, 0xF0000000, 5);
226 TestInt32Binop(kExprI32RemS, -3, -3003, 1000); 242 TestInt32Binop(kExprI32RemS, -3, -3003, 1000);
227 TestInt32Binop(kExprI32RemU, 4, 4004, 1000); 243 TestInt32Binop(kExprI32RemU, 4, 4004, 1000);
228 TestInt32Binop(kExprI32And, 0xEE, 0xFFEE, 0xFF0000FF); 244 TestInt32Binop(kExprI32And, 0xEE, 0xFFEE, 0xFF0000FF);
229 TestInt32Binop(kExprI32Ior, 0xF0FF00FF, 0xF0F000EE, 0x000F0011); 245 TestInt32Binop(kExprI32Ior, 0xF0FF00FF, 0xF0F000EE, 0x000F0011);
(...skipping 3093 matching lines...) Expand 10 before | Expand all | Expand 10 after
3323 3339
3324 #if WASM_64 3340 #if WASM_64
3325 TEST(Compile_Wasm_CallIndirect_Many_i64) { CompileCallIndirectMany(kAstI64); } 3341 TEST(Compile_Wasm_CallIndirect_Many_i64) { CompileCallIndirectMany(kAstI64); }
3326 #endif 3342 #endif
3327 3343
3328 3344
3329 TEST(Compile_Wasm_CallIndirect_Many_f32) { CompileCallIndirectMany(kAstF32); } 3345 TEST(Compile_Wasm_CallIndirect_Many_f32) { CompileCallIndirectMany(kAstF32); }
3330 3346
3331 3347
3332 TEST(Compile_Wasm_CallIndirect_Many_f64) { CompileCallIndirectMany(kAstF64); } 3348 TEST(Compile_Wasm_CallIndirect_Many_f64) { CompileCallIndirectMany(kAstF64); }
OLDNEW
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | test/cctest/wasm/wasm-run-utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698