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

Side by Side Diff: test/mjsunit/wasm/asm-wasm-i32.js

Issue 2377903002: [wasm] [asm.js] Fix various asm.js issues. (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « test/mjsunit/wasm/asm-wasm-f64.js ('k') | test/mjsunit/wasm/asm-wasm-u32.js » ('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 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 // Flags: --validate-asm --allow-natives-syntax 5 // Flags: --validate-asm --allow-natives-syntax
6 6
7 function WrapInAsmModule(func) { 7 function WrapInAsmModule(func) {
8 function MODULE_NAME(stdlib) { 8 function MODULE_NAME(stdlib) {
9 "use asm"; 9 "use asm";
10 var imul = stdlib.Math.imul; 10 var imul = stdlib.Math.imul;
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 a = a | 0; 173 a = a | 0;
174 b = b | 0; 174 b = b | 0;
175 return Math_max(a | 0, b | 0) | 0; 175 return Math_max(a | 0, b | 0) | 0;
176 } 176 }
177 177
178 function i32_abs(a) { 178 function i32_abs(a) {
179 a = a | 0; 179 a = a | 0;
180 return Math_abs(a | 0) | 0; 180 return Math_abs(a | 0) | 0;
181 } 181 }
182 182
183 function i32_neg(a) {
184 a = a | 0;
185 return (-a) | 0;
186 }
187
188 function i32_invert(a) {
189 a = a | 0;
190 return (~a) | 0;
191 }
192
183 var inputs = [ 193 var inputs = [
184 0, 1, 2, 3, 4, 194 0, 1, 2, 3, 4,
185 10, 20, 30, 31, 32, 33, 100, 2000, 195 10, 20, 30, 31, 32, 33, 100, 2000,
186 30000, 400000, 5000000, 196 30000, 400000, 5000000,
187 100000000, 2000000000, 197 100000000, 2000000000,
188 2147483646, 198 2147483646,
189 2147483647, 199 2147483647,
190 2147483648, 200 2147483648,
191 2147483649, 201 2147483649,
192 0x273a798e, 0x187937a3, 0xece3af83, 0x5495a16b, 0x0b668ecc, 0x11223344, 202 0x273a798e, 0x187937a3, 0xece3af83, 0x5495a16b, 0x0b668ecc, 0x11223344,
(...skipping 26 matching lines...) Expand all
219 i32_shr, 229 i32_shr,
220 i32_sar, 230 i32_sar,
221 i32_eq, 231 i32_eq,
222 i32_ne, 232 i32_ne,
223 i32_lt, 233 i32_lt,
224 i32_lteq, 234 i32_lteq,
225 i32_gt, 235 i32_gt,
226 i32_gteq, 236 i32_gteq,
227 i32_min, 237 i32_min,
228 i32_max, 238 i32_max,
229 i32_abs 239 i32_abs,
240 i32_neg,
241 i32_invert,
aseemgarg 2016/09/28 06:23:39 is the last comma allowed?
bradn 2016/09/28 16:33:53 Yep. Changed to match the style in the other tests
230 ]; 242 ];
231 243
232 (function () { 244 (function () {
233 for (func of funcs) { 245 for (func of funcs) {
234 RunAsmJsTest(WrapInAsmModule(func), function (module) { 246 RunAsmJsTest(WrapInAsmModule(func), function (module) {
235 if (func.length == 1) { 247 if (func.length == 1) {
236 for (a of inputs) { 248 for (a of inputs) {
237 assertEquals(func(a), module.main(a)); 249 assertEquals(func(a), module.main(a));
238 } 250 }
239 } else { 251 } else {
240 for (a of inputs) { 252 for (a of inputs) {
241 for (b of inputs) { 253 for (b of inputs) {
242 assertEquals(func(a, b), module.main(a, b)); 254 assertEquals(func(a, b), module.main(a, b));
243 } 255 }
244 } 256 }
245 } 257 }
246 }); 258 });
247 } 259 }
248 260
249 })(); 261 })();
OLDNEW
« no previous file with comments | « test/mjsunit/wasm/asm-wasm-f64.js ('k') | test/mjsunit/wasm/asm-wasm-u32.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698