Skip to content
This repository was archived by the owner on Jan 26, 2022. It is now read-only.

Remove the minNum and maxNum functions. #345

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 2 additions & 28 deletions src/ecmascript_simd.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,6 @@ function isTypedArray(o) {
(o instanceof Float64Array);
}

function minNum(x, y) {
return x != x ? y :
y != y ? x :
Math.min(x, y);
}

function maxNum(x, y) {
return x != x ? y :
y != y ? x :
Math.max(x, y);
}

function clamp(a, min, max) {
if (a < min)
return min;
Expand Down Expand Up @@ -628,7 +616,7 @@ var float32x4 = {
mulFn: binaryMul,
fns: ["check", "splat", "replaceLane", "select",
"equal", "notEqual", "lessThan", "lessThanOrEqual", "greaterThan", "greaterThanOrEqual",
"add", "sub", "mul", "div", "neg", "abs", "min", "max", "minNum", "maxNum",
"add", "sub", "mul", "div", "neg", "abs", "min", "max",
"reciprocalApproximation", "reciprocalSqrtApproximation", "sqrt",
"load", "load1", "load2", "load3", "store", "store1", "store2", "store3"],
}
Expand Down Expand Up @@ -872,7 +860,7 @@ if (typeof simdPhase2 !== 'undefined') {
mulFn: binaryMul,
fns: ["check", "splat", "replaceLane", "select",
"equal", "notEqual", "lessThan", "lessThanOrEqual", "greaterThan", "greaterThanOrEqual",
"add", "sub", "mul", "div", "neg", "abs", "min", "max", "minNum", "maxNum",
"add", "sub", "mul", "div", "neg", "abs", "min", "max",
"reciprocalApproximation", "reciprocalSqrtApproximation", "sqrt",
"load", "store"],
}
Expand Down Expand Up @@ -1087,20 +1075,6 @@ var simdFns = {
}
},

minNum:
function(type) {
return function(a, b) {
return simdBinaryOp(type, minNum, a, b);
}
},

maxNum:
function(type) {
return function(a, b) {
return simdBinaryOp(type, maxNum, a, b);
}
},

load:
function(type) {
return function(tarray, index) {
Expand Down
18 changes: 0 additions & 18 deletions src/ecmascript_simd_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,6 @@
3. This notice may not be removed or altered from any source distribution.
*/

function minNum(x, y) {
return x != x ? y :
y != y ? x :
Math.min(x, y);
}

function maxNum(x, y) {
return x != x ? y :
y != y ? x :
Math.max(x, y);
}

function sameValue(x, y) {
if (x == y)
return x != 0 || y != 0 || (1/x == 1/y);
Expand Down Expand Up @@ -943,12 +931,6 @@ simdTypes.filter(isFloatType).forEach(function(type) {
test(type.name + ' max', function() {
testBinaryOp(type, 'max', Math.max);
});
test(type.name + ' minNum', function() {
testBinaryOp(type, 'minNum', minNum);
});
test(type.name + ' maxNum', function() {
testBinaryOp(type, 'maxNum', maxNum);
});
test(type.name + ' sqrt', function() {
testUnaryOp(type, 'sqrt', function(a) { return Math.sqrt(a); });
});
Expand Down
46 changes: 0 additions & 46 deletions tc39/spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -841,30 +841,6 @@ <h1>MathMin(n, m)</h1>
</ul>
</emu-clause>

<emu-clause id="max-num" aoid="MaxNum">
<h1>MaxNum(n, m)</h1>
<emu-alg>
1. Assert Type(_n_) is Number and Type(_m_) is Number.
1. If _n_ is *NaN*, return _m_.
1. If _m_ is *NaN*, return _n_.
1. Let _result_ be MathMax(_n_, _m_).
1. ReturnIfAbrupt(_result_).
1. Return _result_.
</emu-alg>
</emu-clause>

<emu-clause id="min-num" aoid="MinNum">
<h1>MinNum(n, m)</h1>
<emu-alg>
1. Assert Type(_n_) is Number and Type(_m_) is Number.
1. If _n_ is *NaN*, return _m_.
1. If _m_ is *NaN*, return _n_.
1. Let _result_ be MathMin(_n_, _m_).
1. ReturnIfAbrupt(_result_).
1. Return _result_.
</emu-alg>
</emu-clause>

<emu-clause id="reciprocal" aoid="ReciprocalApproximation">
<h1>ReciprocalApproximation(n)</h1>
Returns an implementation-dependent approximation to the reciprocal of _n_.
Expand Down Expand Up @@ -1081,28 +1057,6 @@ <h1>_SIMD_Constructor.min(a, b)</h1>
</emu-alg>
</emu-clause>

<emu-clause id="simd-max-num">
<h1>_SIMD_Constructor.maxNum(a, b)</h1>
This operation is only defined on <a href="#simd-floating-point-type">floating point</a> SIMD types.
<emu-alg>
1. If _a_.[[SIMDTypeDescriptor]] is not _SIMD_Descriptor or _b_.[[SIMDTypeDescriptor]] is not _SIMD_Descriptor, throw a TypeError exception.
1. Let _result_ be SIMDBinaryOp(_a_, _b_, MaxNum).
1. ReturnIfAbrupt(_result_).
1. Return _result_.
</emu-alg>
</emu-clause>

<emu-clause id="simd-min-num">
<h1>_SIMD_Constructor.minNum(a, b)</h1>
This operation is only defined on <a href="#simd-floating-point-type">floating point</a> SIMD types.
<emu-alg>
1. If _a_.[[SIMDTypeDescriptor]] is not _SIMD_Descriptor or _b_.[[SIMDTypeDescriptor]] is not _SIMD_Descriptor, throw a TypeError exception.
1. Let _result_ be SIMDBinaryOp(_a_, _b_, MinNum).
1. ReturnIfAbrupt(_result_).
1. Return _result_.
</emu-alg>
</emu-clause>

<emu-clause id="simd-neg">
<h1>_SIMD_Constructor.neg(a)</h1>
<p>This definition uses unary `-` to refer to the abstract operation defined by <a href="http://www.ecma-international.org/ecma-262/6.0/#sec-unary-minus-operator">ES2015 12.5.10 (Unary - Operator)</a>.</p>
Expand Down