Commit 369e0d58 authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[wasm] Enable optimization of Math.pow intrinsic.

R=clemensh@chromium.org
TEST=mjsunit/wasm/asm-wasm-math-intrinsic
BUG=v8:8505

Change-Id: I883c9ad174f7fda5ec5dd24e71ca674de51239b3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1782160Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63521}
parent 1e88fece
......@@ -6397,10 +6397,7 @@ std::pair<WasmImportCallKind, Handle<JSReceiver>> ResolveWasmImportCall(
COMPARE_SIG_FOR_BUILTIN_F64(Exp);
COMPARE_SIG_FOR_BUILTIN_F64(Log);
COMPARE_SIG_FOR_BUILTIN_F64(Atan2);
//===========================================================
// TODO(8505): Math.pow for wasm does not match JS.
// COMPARE_SIG_FOR_BUILTIN_F64(Pow);
//===========================================================
COMPARE_SIG_FOR_BUILTIN_F64(Pow);
COMPARE_SIG_FOR_BUILTIN_F32_F64(Min);
COMPARE_SIG_FOR_BUILTIN_F32_F64(Max);
COMPARE_SIG_FOR_BUILTIN_F32_F64(Abs);
......
......@@ -54,9 +54,6 @@
# Issue 3784: setters-on-elements is flaky
'setters-on-elements': [PASS, FAIL],
# Issue 8505: Math.pow is incorrect for asm.js
'regress/wasm/regress-8505': [SKIP],
# Issue 9380: Memory leaks of shared WebAssembly.Memory objects
'wasm/shared-memory-worker-gc': [SKIP],
......
......@@ -150,18 +150,18 @@ function assertBinop(name, math_func, wasm_func) {
}
let stdlib = this;
function Module_exp(stdlib) {
function Module_pow(stdlib) {
"use asm";
var Stdlib = stdlib.Math.exp;
var Stdlib = stdlib.Math.pow;
function NAME(a, b) {
function pow(a, b) {
a = +a;
b = +b;
return +Stdlib(a, b);
}
return {exp: exp};
return {pow: pow};
}
function wasmBinop(name, sig) {
......@@ -181,8 +181,8 @@ function wasmBinop(name, sig) {
}
function asmBinop(name) {
let instance = Module_exp(stdlib);
assertTrue(%IsAsmWasmCode(Module_exp));
let instance = Module_pow(stdlib);
assertTrue(%IsAsmWasmCode(Module_pow));
let asm_func = instance[name];
if (typeof asm_func != "function") throw "asm[" + full_name + "] not found";
......@@ -190,7 +190,7 @@ function asmBinop(name) {
}
(function TestF64() {
let name = 'exp';
let name = 'pow';
let math_func = Math[name];
let wasm_func = wasmBinop(name, kSig_d_dd);
......
......@@ -246,7 +246,6 @@ function assertBinop(name, math_func, asm_func) {
];
for (name of f64_intrinsics) {
if (name == 'pow') continue; // TODO(8505): asm.js correctness
let math_func = Math[name];
let f32 = false;
print('Testing (f64) Math.' + name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment