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

Unified Diff: test/mjsunit/wasm/asm-wasm-i32.js

Issue 1830703003: [wasm] Enable more ASM->WASM tests. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Enable large unsigned literals test. Created 4 years, 9 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
« no previous file with comments | « test/mjsunit/wasm/asm-wasm-f64.js ('k') | test/mjsunit/wasm/asm-wasm-literals.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/wasm/asm-wasm-i32.js
diff --git a/test/mjsunit/wasm/asm-wasm-i32.js b/test/mjsunit/wasm/asm-wasm-i32.js
index 92c435ff867f876f77d9629eab41dfaa623db8bb..5e13c72b80494192541001483af7047941430830 100644
--- a/test/mjsunit/wasm/asm-wasm-i32.js
+++ b/test/mjsunit/wasm/asm-wasm-i32.js
@@ -8,6 +8,9 @@ function WrapInAsmModule(func) {
function MODULE_NAME(stdlib) {
"use asm";
var imul = stdlib.Math.imul;
+ var Math_max = stdlib.Math.max;
+ var Math_min = stdlib.Math.min;
+ var Math_abs = stdlib.Math.abs;
FUNC_BODY
return {main: FUNC_NAME};
@@ -39,6 +42,9 @@ function RunThreeWayTest(asmfunc, expect) {
}
const imul = Math.imul;
+const Math_max = Math.max;
+const Math_min = Math.min;
+const Math_abs = Math.abs;
function i32_add(a, b) {
a = a | 0;
@@ -160,6 +166,23 @@ function i32_gteq(a, b) {
return 0;
}
+function i32_min(a, b) {
+ a = a | 0;
+ b = b | 0;
+ return Math_min(a | 0, b | 0) | 0;
+}
+
+function i32_max(a, b) {
+ a = a | 0;
+ b = b | 0;
+ return Math_max(a | 0, b | 0) | 0;
+}
+
+function i32_abs(a) {
+ a = a | 0;
+ return Math_abs(a | 0) | 0;
+}
+
var inputs = [
0, 1, 2, 3, 4,
10, 20, 30, 31, 32, 33, 100, 2000,
@@ -205,18 +228,23 @@ var funcs = [
i32_lteq,
i32_gt,
i32_gteq,
- // TODO(titzer): i32_min
- // TODO(titzer): i32_max
- // TODO(titzer): i32_abs
+ i32_min,
+ i32_max,
+ i32_abs
];
(function () {
for (func of funcs) {
RunThreeWayTest(WrapInAsmModule(func), function (module) {
- for (a of inputs) {
- for (b of inputs) {
- var expected = func(a, b);
- assertEquals(expected, module.main(a, b));
+ if (func.length == 1) {
+ for (a of inputs) {
+ assertEquals(func(a), module.main(a));
+ }
+ } else {
+ for (a of inputs) {
+ for (b of inputs) {
+ assertEquals(func(a, b), module.main(a, b));
+ }
}
}
});
« no previous file with comments | « test/mjsunit/wasm/asm-wasm-f64.js ('k') | test/mjsunit/wasm/asm-wasm-literals.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698