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

Side by Side Diff: test/mjsunit/wasm/asm-wasm-u32.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
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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 150
151 function u32_gteq(a, b) { 151 function u32_gteq(a, b) {
152 a = a | 0; 152 a = a | 0;
153 b = b | 0; 153 b = b | 0;
154 if ((a >>> 0) >= (b >>> 0)) { 154 if ((a >>> 0) >= (b >>> 0)) {
155 return 1; 155 return 1;
156 } 156 }
157 return 0; 157 return 0;
158 } 158 }
159 159
160 function u32_neg(a) {
161 a = a | 0;
162 return (-a) | 0;
163 }
164
165 function u32_invert(a) {
166 a = a | 0;
167 return (~a) | 0;
168 }
169
160 170
161 var inputs = [ 171 var inputs = [
162 0, 1, 2, 3, 4, 172 0, 1, 2, 3, 4,
163 10, 20, 30, 31, 32, 33, 100, 2000, 173 10, 20, 30, 31, 32, 33, 100, 2000,
164 30000, 400000, 5000000, 174 30000, 400000, 5000000,
165 100000000, 2000000000, 175 100000000, 2000000000,
166 2147483646, 176 2147483646,
167 2147483647, 177 2147483647,
168 2147483648, 178 2147483648,
169 2147483649, 179 2147483649,
(...skipping 25 matching lines...) Expand all
195 u32_xor, 205 u32_xor,
196 u32_shl, 206 u32_shl,
197 u32_shr, 207 u32_shr,
198 u32_sar, 208 u32_sar,
199 u32_eq, 209 u32_eq,
200 u32_ne, 210 u32_ne,
201 u32_lt, 211 u32_lt,
202 u32_lteq, 212 u32_lteq,
203 u32_gt, 213 u32_gt,
204 u32_gteq, 214 u32_gteq,
215 u32_neg,
216 u32_invert,
205 // TODO(titzer): u32_min 217 // TODO(titzer): u32_min
206 // TODO(titzer): u32_max 218 // TODO(titzer): u32_max
207 // TODO(titzer): u32_abs 219 // TODO(titzer): u32_abs
208 ]; 220 ];
209 221
210 (function () { 222 (function () {
211 for (func of funcs) { 223 for (func of funcs) {
212 RunAsmJsTest(WrapInAsmModule(func), function (module) { 224 RunAsmJsTest(WrapInAsmModule(func), function (module) {
213 for (a of inputs) { 225 for (a of inputs) {
214 for (b of inputs) { 226 for (b of inputs) {
215 var expected = func(a, b); 227 var expected = func(a, b);
216 assertEquals(expected, module.main(a, b)); 228 assertEquals(expected, module.main(a, b));
217 } 229 }
218 } 230 }
219 }); 231 });
220 } 232 }
221 233
222 })(); 234 })();
OLDNEW
« test/mjsunit/wasm/asm-wasm-i32.js ('K') | « test/mjsunit/wasm/asm-wasm-i32.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698