Commit 86016622 authored by hablich's avatar hablich Committed by Commit bot

Revert of [simd.js] Update to spec version 0.8.2. (patchset #11 id:200001 of...

Revert of [simd.js] Update to spec version 0.8.2. (patchset #11 id:200001 of https://codereview.chromium.org/1294513004/ )

Reason for revert:
Fails tests:
http://build.chromium.org/p/client.v8/builders/V8%20Linux%20-%20deadcode/builds/5073/steps/steps/logs/stdio

Original issue's description:
> [simd.js] Update to spec version 0.8.2.
>
> Adds Uint32x4, Uint16x8, and Uint8x16 types.
> Adds all functions in the current spec, except for loads and stores.
>
> LOG=Y
> BUG=v8:4124
>
> Committed: https://crrev.com/4be6d37fd1ad0a6e0ea37da8863ae5169c2b89ba
> Cr-Commit-Position: refs/heads/master@{#30322}

TBR=littledan@chromium.org,bbudge@google.com,bmeurer@chromium.org,hpayer@chromium.org,bbudge@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=v8:4124

Review URL: https://codereview.chromium.org/1309513005

Cr-Commit-Position: refs/heads/master@{#30323}
parent 4be6d37f
......@@ -216,12 +216,9 @@ enum BindingFlags {
V(STRONG_MAP_CACHE_INDEX, Object, strong_map_cache) \
V(SYMBOL_FUNCTION_INDEX, JSFunction, symbol_function) \
V(UINT16_ARRAY_FUN_INDEX, JSFunction, uint16_array_fun) \
V(UINT16X8_FUNCTION_INDEX, JSFunction, uint16x8_function) \
V(UINT32_ARRAY_FUN_INDEX, JSFunction, uint32_array_fun) \
V(UINT32X4_FUNCTION_INDEX, JSFunction, uint32x4_function) \
V(UINT8_ARRAY_FUN_INDEX, JSFunction, uint8_array_fun) \
V(UINT8_CLAMPED_ARRAY_FUN_INDEX, JSFunction, uint8_clamped_array_fun) \
V(UINT8X16_FUNCTION_INDEX, JSFunction, uint8x16_function) \
NATIVE_CONTEXT_IMPORTED_FIELDS(V) \
NATIVE_CONTEXT_IMPORTED_FIELDS_FOR_PROXY(V)
......
......@@ -23,12 +23,6 @@ FUNCTION(Int16x8, int16x8, 8)
FUNCTION(Int8x16, int8x16, 16)
endmacro
macro SIMD_UINT_TYPES(FUNCTION)
FUNCTION(Uint32x4, uint32x4, 4)
FUNCTION(Uint16x8, uint16x8, 8)
FUNCTION(Uint8x16, uint8x16, 16)
endmacro
macro SIMD_BOOL_TYPES(FUNCTION)
FUNCTION(Bool32x4, bool32x4, 4)
FUNCTION(Bool16x8, bool16x8, 8)
......@@ -38,7 +32,6 @@ endmacro
macro SIMD_ALL_TYPES(FUNCTION)
SIMD_FLOAT_TYPES(FUNCTION)
SIMD_INT_TYPES(FUNCTION)
SIMD_UINT_TYPES(FUNCTION)
SIMD_BOOL_TYPES(FUNCTION)
endmacro
......@@ -92,23 +85,19 @@ function NAMEValueOf() {
function NAMEExtractLaneJS(instance, lane) {
return %NAMEExtractLane(instance, lane);
}
endmacro
SIMD_ALL_TYPES(DECLARE_COMMON_FUNCTIONS)
macro DECLARE_INT_FUNCTIONS(NAME, TYPE, LANES)
function NAMEShiftLeftByScalarJS(instance, shift) {
return %NAMEShiftLeftByScalar(instance, shift);
function NAMEEqualJS(a, b) {
return %NAMEEqual(a, b);
}
function NAMEShiftRightArithmeticByScalarJS(instance, shift) {
return %NAMEShiftRightArithmeticByScalar(instance, shift);
function NAMENotEqualJS(a, b) {
return %NAMENotEqual(a, b);
}
endmacro
SIMD_INT_TYPES(DECLARE_INT_FUNCTIONS)
SIMD_ALL_TYPES(DECLARE_COMMON_FUNCTIONS)
macro DECLARE_UINT_FUNCTIONS(NAME, TYPE, LANES)
macro DECLARE_INT_FUNCTIONS(NAME, TYPE, LANES)
function NAMEShiftLeftByScalarJS(instance, shift) {
return %NAMEShiftLeftByScalar(instance, shift);
}
......@@ -117,57 +106,12 @@ function NAMEShiftRightLogicalByScalarJS(instance, shift) {
return %NAMEShiftRightLogicalByScalar(instance, shift);
}
function NAMEHorizontalSumJS(instance) {
return %NAMEHorizontalSum(instance);
}
endmacro
SIMD_UINT_TYPES(DECLARE_UINT_FUNCTIONS)
macro SIMD_SMALL_INT_TYPES(FUNCTION)
FUNCTION(Int16x8)
FUNCTION(Int8x16)
FUNCTION(Uint8x16)
FUNCTION(Uint16x8)
endmacro
macro DECLARE_SMALL_INT_FUNCTIONS(NAME)
function NAMEAddSaturateJS(a, b) {
return %NAMEAddSaturate(a, b);
}
function NAMESubSaturateJS(a, b) {
return %NAMESubSaturate(a, b);
}
endmacro
SIMD_SMALL_INT_TYPES(DECLARE_SMALL_INT_FUNCTIONS)
macro SIMD_SMALL_UINT_TYPES(FUNCTION)
FUNCTION(Uint8x16)
FUNCTION(Uint16x8)
endmacro
macro DECLARE_SMALL_UINT_FUNCTIONS(NAME)
function NAMEAbsoluteDifferenceJS(a, b) {
return %NAMEAbsoluteDifference(a, b);
}
function NAMEWidenedAbsoluteDifferenceJS(a, b) {
return %NAMEWidenedAbsoluteDifference(a, b);
}
endmacro
SIMD_SMALL_UINT_TYPES(DECLARE_SMALL_UINT_FUNCTIONS)
macro DECLARE_SIGNED_FUNCTIONS(NAME, TYPE, LANES)
function NAMENegJS(a) {
return %NAMENeg(a);
function NAMEShiftRightArithmeticByScalarJS(instance, shift) {
return %NAMEShiftRightArithmeticByScalar(instance, shift);
}
endmacro
SIMD_FLOAT_TYPES(DECLARE_SIGNED_FUNCTIONS)
SIMD_INT_TYPES(DECLARE_SIGNED_FUNCTIONS)
SIMD_INT_TYPES(DECLARE_INT_FUNCTIONS)
macro DECLARE_BOOL_FUNCTIONS(NAME, TYPE, LANES)
function NAMEReplaceLaneJS(instance, lane, value) {
......@@ -185,10 +129,22 @@ endmacro
SIMD_BOOL_TYPES(DECLARE_BOOL_FUNCTIONS)
macro SIMD_UNSIGNED_INT_TYPES(FUNCTION)
FUNCTION(Int16x8)
FUNCTION(Int8x16)
endmacro
macro DECLARE_UNSIGNED_INT_FUNCTIONS(NAME)
function NAMEUnsignedExtractLaneJS(instance, lane) {
return %NAMEUnsignedExtractLane(instance, lane);
}
endmacro
SIMD_UNSIGNED_INT_TYPES(DECLARE_UNSIGNED_INT_FUNCTIONS)
macro SIMD_NUMERIC_TYPES(FUNCTION)
SIMD_FLOAT_TYPES(FUNCTION)
SIMD_INT_TYPES(FUNCTION)
SIMD_UINT_TYPES(FUNCTION)
endmacro
macro DECLARE_NUMERIC_FUNCTIONS(NAME, TYPE, LANES)
......@@ -200,6 +156,10 @@ function NAMESelectJS(selector, a, b) {
return %NAMESelect(selector, a, b);
}
function NAMENegJS(a) {
return %NAMENeg(a);
}
function NAMEAddJS(a, b) {
return %NAMEAdd(a, b);
}
......@@ -220,14 +180,6 @@ function NAMEMaxJS(a, b) {
return %NAMEMax(a, b);
}
function NAMEEqualJS(a, b) {
return %NAMEEqual(a, b);
}
function NAMENotEqualJS(a, b) {
return %NAMENotEqual(a, b);
}
function NAMELessThanJS(a, b) {
return %NAMELessThan(a, b);
}
......@@ -249,7 +201,6 @@ SIMD_NUMERIC_TYPES(DECLARE_NUMERIC_FUNCTIONS)
macro SIMD_LOGICAL_TYPES(FUNCTION)
SIMD_INT_TYPES(FUNCTION)
SIMD_UINT_TYPES(FUNCTION)
SIMD_BOOL_TYPES(FUNCTION)
endmacro
......@@ -275,15 +226,7 @@ SIMD_LOGICAL_TYPES(DECLARE_LOGICAL_FUNCTIONS)
macro SIMD_FROM_TYPES(FUNCTION)
FUNCTION(Float32x4, Int32x4)
FUNCTION(Float32x4, Uint32x4)
FUNCTION(Int32x4, Float32x4)
FUNCTION(Int32x4, Uint32x4)
FUNCTION(Uint32x4, Float32x4)
FUNCTION(Uint32x4, Int32x4)
FUNCTION(Int16x8, Uint16x8)
FUNCTION(Uint16x8, Int16x8)
FUNCTION(Int8x16, Uint8x16)
FUNCTION(Uint8x16, Int8x16)
endmacro
macro DECLARE_FROM_FUNCTIONS(TO, FROM)
......@@ -296,47 +239,17 @@ SIMD_FROM_TYPES(DECLARE_FROM_FUNCTIONS)
macro SIMD_FROM_BITS_TYPES(FUNCTION)
FUNCTION(Float32x4, Int32x4)
FUNCTION(Float32x4, Uint32x4)
FUNCTION(Float32x4, Int16x8)
FUNCTION(Float32x4, Uint16x8)
FUNCTION(Float32x4, Int8x16)
FUNCTION(Float32x4, Uint8x16)
FUNCTION(Int32x4, Float32x4)
FUNCTION(Int32x4, Uint32x4)
FUNCTION(Int32x4, Int16x8)
FUNCTION(Int32x4, Uint16x8)
FUNCTION(Int32x4, Int8x16)
FUNCTION(Int32x4, Uint8x16)
FUNCTION(Uint32x4, Float32x4)
FUNCTION(Uint32x4, Int32x4)
FUNCTION(Uint32x4, Int16x8)
FUNCTION(Uint32x4, Uint16x8)
FUNCTION(Uint32x4, Int8x16)
FUNCTION(Uint32x4, Uint8x16)
FUNCTION(Int16x8, Float32x4)
FUNCTION(Int16x8, Int32x4)
FUNCTION(Int16x8, Uint32x4)
FUNCTION(Int16x8, Uint16x8)
FUNCTION(Int16x8, Int8x16)
FUNCTION(Int16x8, Uint8x16)
FUNCTION(Uint16x8, Float32x4)
FUNCTION(Uint16x8, Int32x4)
FUNCTION(Uint16x8, Uint32x4)
FUNCTION(Uint16x8, Int16x8)
FUNCTION(Uint16x8, Int8x16)
FUNCTION(Uint16x8, Uint8x16)
FUNCTION(Int8x16, Float32x4)
FUNCTION(Int8x16, Int32x4)
FUNCTION(Int8x16, Uint32x4)
FUNCTION(Int8x16, Int16x8)
FUNCTION(Int8x16, Uint16x8)
FUNCTION(Int8x16, Uint8x16)
FUNCTION(Uint8x16, Float32x4)
FUNCTION(Uint8x16, Int32x4)
FUNCTION(Uint8x16, Uint32x4)
FUNCTION(Uint8x16, Int16x8)
FUNCTION(Uint8x16, Uint16x8)
FUNCTION(Uint8x16, Int8x16)
endmacro
macro DECLARE_FROM_BITS_FUNCTIONS(TO, FROM)
......@@ -349,83 +262,60 @@ SIMD_FROM_BITS_TYPES(DECLARE_FROM_BITS_FUNCTIONS)
//-------------------------------------------------------------------
macro SIMD_X4_TYPES(FUNCTION)
FUNCTION(Float32x4)
FUNCTION(Int32x4)
FUNCTION(Uint32x4)
FUNCTION(Bool32x4)
endmacro
macro DECLARE_X4_FUNCTIONS(NAME)
function NAMESplat(s) {
return %CreateNAME(s, s, s, s);
function Float32x4Constructor(c0, c1, c2, c3) {
if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Float32x4");
return %CreateFloat32x4(TO_NUMBER_INLINE(c0), TO_NUMBER_INLINE(c1),
TO_NUMBER_INLINE(c2), TO_NUMBER_INLINE(c3));
}
function NAMESwizzleJS(a, c0, c1, c2, c3) {
return %NAMESwizzle(a, c0, c1, c2, c3);
}
function NAMEShuffleJS(a, b, c0, c1, c2, c3) {
return %NAMEShuffle(a, b, c0, c1, c2, c3);
function Float32x4Splat(s) {
return %CreateFloat32x4(s, s, s, s);
}
endmacro
SIMD_X4_TYPES(DECLARE_X4_FUNCTIONS)
macro SIMD_X8_TYPES(FUNCTION)
FUNCTION(Int16x8)
FUNCTION(Uint16x8)
FUNCTION(Bool16x8)
endmacro
macro DECLARE_X8_FUNCTIONS(NAME)
function NAMESplat(s) {
return %CreateNAME(s, s, s, s, s, s, s, s);
function Float32x4AbsJS(a) {
return %Float32x4Abs(a);
}
function NAMESwizzleJS(a, c0, c1, c2, c3, c4, c5, c6, c7) {
return %NAMESwizzle(a, c0, c1, c2, c3, c4, c5, c6, c7);
function Float32x4SqrtJS(a) {
return %Float32x4Sqrt(a);
}
function NAMEShuffleJS(a, b, c0, c1, c2, c3, c4, c5, c6, c7) {
return %NAMEShuffle(a, b, c0, c1, c2, c3, c4, c5, c6, c7);
function Float32x4RecipApproxJS(a) {
return %Float32x4RecipApprox(a);
}
endmacro
SIMD_X8_TYPES(DECLARE_X8_FUNCTIONS)
macro SIMD_X16_TYPES(FUNCTION)
FUNCTION(Int8x16)
FUNCTION(Uint8x16)
FUNCTION(Bool8x16)
endmacro
function Float32x4RecipSqrtApproxJS(a) {
return %Float32x4RecipSqrtApprox(a);
}
macro DECLARE_X16_FUNCTIONS(NAME)
function NAMESplat(s) {
return %CreateNAME(s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s);
function Float32x4DivJS(a, b) {
return %Float32x4Div(a, b);
}
function NAMESwizzleJS(a, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11,
c12, c13, c14, c15) {
return %NAMESwizzle(a, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11,
c12, c13, c14, c15);
function Float32x4MinNumJS(a, b) {
return %Float32x4MinNum(a, b);
}
function NAMEShuffleJS(a, b, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10,
c11, c12, c13, c14, c15) {
return %NAMEShuffle(a, b, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10,
c11, c12, c13, c14, c15);
function Float32x4MaxNumJS(a, b) {
return %Float32x4MaxNum(a, b);
}
endmacro
SIMD_X16_TYPES(DECLARE_X16_FUNCTIONS)
//-------------------------------------------------------------------
function Float32x4SwizzleJS(a, c0, c1, c2, c3) {
return %Float32x4Swizzle(a, c0, c1, c2, c3);
}
function Float32x4Constructor(c0, c1, c2, c3) {
if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Float32x4");
return %CreateFloat32x4(TO_NUMBER_INLINE(c0), TO_NUMBER_INLINE(c1),
TO_NUMBER_INLINE(c2), TO_NUMBER_INLINE(c3));
function Float32x4ShuffleJS(a, b, c0, c1, c2, c3) {
return %Float32x4Shuffle(a, b, c0, c1, c2, c3);
}
......@@ -436,10 +326,18 @@ function Int32x4Constructor(c0, c1, c2, c3) {
}
function Uint32x4Constructor(c0, c1, c2, c3) {
if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Uint32x4");
return %CreateUint32x4(TO_NUMBER_INLINE(c0), TO_NUMBER_INLINE(c1),
TO_NUMBER_INLINE(c2), TO_NUMBER_INLINE(c3));
function Int32x4Splat(s) {
return %CreateInt32x4(s, s, s, s);
}
function Int32x4SwizzleJS(a, c0, c1, c2, c3) {
return %Int32x4Swizzle(a, c0, c1, c2, c3);
}
function Int32x4ShuffleJS(a, b, c0, c1, c2, c3) {
return %Int32x4Shuffle(a, b, c0, c1, c2, c3);
}
......@@ -449,6 +347,20 @@ function Bool32x4Constructor(c0, c1, c2, c3) {
}
function Bool32x4Splat(s) {
return %CreateBool32x4(s, s, s, s);
}
function Bool32x4SwizzleJS(a, c0, c1, c2, c3) {
return %Bool32x4Swizzle(a, c0, c1, c2, c3);
}
function Bool32x4ShuffleJS(a, b, c0, c1, c2, c3) {
return %Bool32x4Shuffle(a, b, c0, c1, c2, c3);
}
function Int16x8Constructor(c0, c1, c2, c3, c4, c5, c6, c7) {
if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Int16x8");
return %CreateInt16x8(TO_NUMBER_INLINE(c0), TO_NUMBER_INLINE(c1),
......@@ -458,12 +370,18 @@ function Int16x8Constructor(c0, c1, c2, c3, c4, c5, c6, c7) {
}
function Uint16x8Constructor(c0, c1, c2, c3, c4, c5, c6, c7) {
if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Uint16x8");
return %CreateUint16x8(TO_NUMBER_INLINE(c0), TO_NUMBER_INLINE(c1),
TO_NUMBER_INLINE(c2), TO_NUMBER_INLINE(c3),
TO_NUMBER_INLINE(c4), TO_NUMBER_INLINE(c5),
TO_NUMBER_INLINE(c6), TO_NUMBER_INLINE(c7));
function Int16x8Splat(s) {
return %CreateInt16x8(s, s, s, s, s, s, s, s);
}
function Int16x8SwizzleJS(a, c0, c1, c2, c3, c4, c5, c6, c7) {
return %Int16x8Swizzle(a, c0, c1, c2, c3, c4, c5, c6, c7);
}
function Int16x8ShuffleJS(a, b, c0, c1, c2, c3, c4, c5, c6, c7) {
return %Int16x8Shuffle(a, b, c0, c1, c2, c3, c4, c5, c6, c7);
}
......@@ -473,6 +391,21 @@ function Bool16x8Constructor(c0, c1, c2, c3, c4, c5, c6, c7) {
}
function Bool16x8Splat(s) {
return %CreateBool16x8(s, s, s, s, s, s, s, s);
}
function Bool16x8SwizzleJS(a, c0, c1, c2, c3, c4, c5, c6, c7) {
return %Bool16x8Swizzle(a, c0, c1, c2, c3, c4, c5, c6, c7);
}
function Bool16x8ShuffleJS(a, b, c0, c1, c2, c3, c4, c5, c6, c7) {
return %Bool16x8Shuffle(a, b, c0, c1, c2, c3, c4, c5, c6, c7);
}
function Int8x16Constructor(c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11,
c12, c13, c14, c15) {
if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Int8x16");
......@@ -487,60 +420,49 @@ function Int8x16Constructor(c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11,
}
function Uint8x16Constructor(c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11,
c12, c13, c14, c15) {
if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Uint8x16");
return %CreateUint8x16(TO_NUMBER_INLINE(c0), TO_NUMBER_INLINE(c1),
TO_NUMBER_INLINE(c2), TO_NUMBER_INLINE(c3),
TO_NUMBER_INLINE(c4), TO_NUMBER_INLINE(c5),
TO_NUMBER_INLINE(c6), TO_NUMBER_INLINE(c7),
TO_NUMBER_INLINE(c8), TO_NUMBER_INLINE(c9),
TO_NUMBER_INLINE(c10), TO_NUMBER_INLINE(c11),
TO_NUMBER_INLINE(c12), TO_NUMBER_INLINE(c13),
TO_NUMBER_INLINE(c14), TO_NUMBER_INLINE(c15));
function Int8x16Splat(s) {
return %CreateInt8x16(s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s);
}
function Bool8x16Constructor(c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11,
function Int8x16SwizzleJS(a, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11,
c12, c13, c14, c15) {
if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Bool8x16");
return %CreateBool8x16(c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
c13, c14, c15);
}
function Float32x4AbsJS(a) {
return %Float32x4Abs(a);
}
function Float32x4SqrtJS(a) {
return %Float32x4Sqrt(a);
return %Int8x16Swizzle(a, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11,
c12, c13, c14, c15);
}
function Float32x4RecipApproxJS(a) {
return %Float32x4RecipApprox(a);
function Int8x16ShuffleJS(a, b, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10,
c11, c12, c13, c14, c15) {
return %Int8x16Shuffle(a, b, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10,
c11, c12, c13, c14, c15);
}
function Float32x4RecipSqrtApproxJS(a) {
return %Float32x4RecipSqrtApprox(a);
function Bool8x16Constructor(c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11,
c12, c13, c14, c15) {
if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Bool8x16");
return %CreateBool8x16(c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
c13, c14, c15);
}
function Float32x4DivJS(a, b) {
return %Float32x4Div(a, b);
function Bool8x16Splat(s) {
return %CreateBool8x16(s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s);
}
function Float32x4MinNumJS(a, b) {
return %Float32x4MinNum(a, b);
function Bool8x16SwizzleJS(a, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11,
c12, c13, c14, c15) {
return %Bool8x16Swizzle(a, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11,
c12, c13, c14, c15);
}
function Float32x4MaxNumJS(a, b) {
return %Float32x4MaxNum(a, b);
function Bool8x16ShuffleJS(a, b, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10,
c11, c12, c13, c14, c15) {
return %Bool8x16Shuffle(a, b, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10,
c11, c12, c13, c14, c15);
}
......@@ -592,13 +514,9 @@ utils.InstallFunctions(GlobalFloat32x4, DONT_ENUM, [
'swizzle', Float32x4SwizzleJS,
'shuffle', Float32x4ShuffleJS,
'fromInt32x4', Float32x4FromInt32x4JS,
'fromUint32x4', Float32x4FromUint32x4JS,
'fromInt32x4Bits', Float32x4FromInt32x4BitsJS,
'fromUint32x4Bits', Float32x4FromUint32x4BitsJS,
'fromInt16x8Bits', Float32x4FromInt16x8BitsJS,
'fromUint16x8Bits', Float32x4FromUint16x8BitsJS,
'fromInt8x16Bits', Float32x4FromInt8x16BitsJS,
'fromUint8x16Bits', Float32x4FromUint8x16BitsJS,
]);
utils.InstallFunctions(GlobalInt32x4, DONT_ENUM, [
......@@ -617,6 +535,7 @@ utils.InstallFunctions(GlobalInt32x4, DONT_ENUM, [
'xor', Int32x4XorJS,
'not', Int32x4NotJS,
'shiftLeftByScalar', Int32x4ShiftLeftByScalarJS,
'shiftRightLogicalByScalar', Int32x4ShiftRightLogicalByScalarJS,
'shiftRightArithmeticByScalar', Int32x4ShiftRightArithmeticByScalarJS,
'lessThan', Int32x4LessThanJS,
'lessThanOrEqual', Int32x4LessThanOrEqualJS,
......@@ -628,49 +547,9 @@ utils.InstallFunctions(GlobalInt32x4, DONT_ENUM, [
'swizzle', Int32x4SwizzleJS,
'shuffle', Int32x4ShuffleJS,
'fromFloat32x4', Int32x4FromFloat32x4JS,
'fromUint32x4', Int32x4FromUint32x4JS,
'fromFloat32x4Bits', Int32x4FromFloat32x4BitsJS,
'fromUint32x4Bits', Int32x4FromUint32x4BitsJS,
'fromInt16x8Bits', Int32x4FromInt16x8BitsJS,
'fromUint16x8Bits', Int32x4FromUint16x8BitsJS,
'fromInt8x16Bits', Int32x4FromInt8x16BitsJS,
'fromUint8x16Bits', Int32x4FromUint8x16BitsJS,
]);
utils.InstallFunctions(GlobalUint32x4, DONT_ENUM, [
'splat', Uint32x4Splat,
'check', Uint32x4CheckJS,
'extractLane', Uint32x4ExtractLaneJS,
'replaceLane', Uint32x4ReplaceLaneJS,
'add', Uint32x4AddJS,
'sub', Uint32x4SubJS,
'mul', Uint32x4MulJS,
'min', Uint32x4MinJS,
'max', Uint32x4MaxJS,
'and', Uint32x4AndJS,
'or', Uint32x4OrJS,
'xor', Uint32x4XorJS,
'not', Uint32x4NotJS,
'shiftLeftByScalar', Uint32x4ShiftLeftByScalarJS,
'shiftRightLogicalByScalar', Uint32x4ShiftRightLogicalByScalarJS,
'horizontalSum', Uint32x4HorizontalSumJS,
'lessThan', Uint32x4LessThanJS,
'lessThanOrEqual', Uint32x4LessThanOrEqualJS,
'greaterThan', Uint32x4GreaterThanJS,
'greaterThanOrEqual', Uint32x4GreaterThanOrEqualJS,
'equal', Uint32x4EqualJS,
'notEqual', Uint32x4NotEqualJS,
'select', Uint32x4SelectJS,
'swizzle', Uint32x4SwizzleJS,
'shuffle', Uint32x4ShuffleJS,
'fromFloat32x4', Uint32x4FromFloat32x4JS,
'fromInt32x4', Uint32x4FromInt32x4JS,
'fromFloat32x4Bits', Uint32x4FromFloat32x4BitsJS,
'fromInt32x4Bits', Uint32x4FromInt32x4BitsJS,
'fromInt16x8Bits', Uint32x4FromInt16x8BitsJS,
'fromUint16x8Bits', Uint32x4FromUint16x8BitsJS,
'fromInt8x16Bits', Uint32x4FromInt8x16BitsJS,
'fromUint8x16Bits', Uint32x4FromUint8x16BitsJS,
]);
utils.InstallFunctions(GlobalBool32x4, DONT_ENUM, [
......@@ -684,6 +563,8 @@ utils.InstallFunctions(GlobalBool32x4, DONT_ENUM, [
'not', Bool32x4NotJS,
'anyTrue', Bool32x4AnyTrueJS,
'allTrue', Bool32x4AllTrueJS,
'equal', Bool32x4EqualJS,
'notEqual', Bool32x4NotEqualJS,
'swizzle', Bool32x4SwizzleJS,
'shuffle', Bool32x4ShuffleJS,
]);
......@@ -692,12 +573,11 @@ utils.InstallFunctions(GlobalInt16x8, DONT_ENUM, [
'splat', Int16x8Splat,
'check', Int16x8CheckJS,
'extractLane', Int16x8ExtractLaneJS,
'unsignedExtractLane', Int16x8UnsignedExtractLaneJS,
'replaceLane', Int16x8ReplaceLaneJS,
'neg', Int16x8NegJS,
'add', Int16x8AddJS,
'sub', Int16x8SubJS,
'addSaturate', Int16x8AddSaturateJS,
'subSaturate', Int16x8SubSaturateJS,
'mul', Int16x8MulJS,
'min', Int16x8MinJS,
'max', Int16x8MaxJS,
......@@ -706,6 +586,7 @@ utils.InstallFunctions(GlobalInt16x8, DONT_ENUM, [
'xor', Int16x8XorJS,
'not', Int16x8NotJS,
'shiftLeftByScalar', Int16x8ShiftLeftByScalarJS,
'shiftRightLogicalByScalar', Int16x8ShiftRightLogicalByScalarJS,
'shiftRightArithmeticByScalar', Int16x8ShiftRightArithmeticByScalarJS,
'lessThan', Int16x8LessThanJS,
'lessThanOrEqual', Int16x8LessThanOrEqualJS,
......@@ -716,52 +597,9 @@ utils.InstallFunctions(GlobalInt16x8, DONT_ENUM, [
'select', Int16x8SelectJS,
'swizzle', Int16x8SwizzleJS,
'shuffle', Int16x8ShuffleJS,
'fromUint16x8', Int16x8FromUint16x8JS,
'fromFloat32x4Bits', Int16x8FromFloat32x4BitsJS,
'fromInt32x4Bits', Int16x8FromInt32x4BitsJS,
'fromUint32x4Bits', Int16x8FromUint32x4BitsJS,
'fromUint16x8Bits', Int16x8FromUint16x8BitsJS,
'fromInt8x16Bits', Int16x8FromInt8x16BitsJS,
'fromUint8x16Bits', Int16x8FromUint8x16BitsJS,
]);
utils.InstallFunctions(GlobalUint16x8, DONT_ENUM, [
'splat', Uint16x8Splat,
'check', Uint16x8CheckJS,
'extractLane', Uint16x8ExtractLaneJS,
'replaceLane', Uint16x8ReplaceLaneJS,
'add', Uint16x8AddJS,
'sub', Uint16x8SubJS,
'addSaturate', Uint16x8AddSaturateJS,
'subSaturate', Uint16x8SubSaturateJS,
'mul', Uint16x8MulJS,
'min', Uint16x8MinJS,
'max', Uint16x8MaxJS,
'and', Uint16x8AndJS,
'or', Uint16x8OrJS,
'xor', Uint16x8XorJS,
'not', Uint16x8NotJS,
'shiftLeftByScalar', Uint16x8ShiftLeftByScalarJS,
'shiftRightLogicalByScalar', Uint16x8ShiftRightLogicalByScalarJS,
'horizontalSum', Uint16x8HorizontalSumJS,
'absoluteDifference', Uint16x8AbsoluteDifferenceJS,
'widenedAbsoluteDifference', Uint16x8WidenedAbsoluteDifferenceJS,
'lessThan', Uint16x8LessThanJS,
'lessThanOrEqual', Uint16x8LessThanOrEqualJS,
'greaterThan', Uint16x8GreaterThanJS,
'greaterThanOrEqual', Uint16x8GreaterThanOrEqualJS,
'equal', Uint16x8EqualJS,
'notEqual', Uint16x8NotEqualJS,
'select', Uint16x8SelectJS,
'swizzle', Uint16x8SwizzleJS,
'shuffle', Uint16x8ShuffleJS,
'fromInt16x8', Uint16x8FromInt16x8JS,
'fromFloat32x4Bits', Uint16x8FromFloat32x4BitsJS,
'fromInt32x4Bits', Uint16x8FromInt32x4BitsJS,
'fromUint32x4Bits', Uint16x8FromUint32x4BitsJS,
'fromInt16x8Bits', Uint16x8FromInt16x8BitsJS,
'fromInt8x16Bits', Uint16x8FromInt8x16BitsJS,
'fromUint8x16Bits', Uint16x8FromUint8x16BitsJS,
]);
utils.InstallFunctions(GlobalBool16x8, DONT_ENUM, [
......@@ -775,6 +613,8 @@ utils.InstallFunctions(GlobalBool16x8, DONT_ENUM, [
'not', Bool16x8NotJS,
'anyTrue', Bool16x8AnyTrueJS,
'allTrue', Bool16x8AllTrueJS,
'equal', Bool16x8EqualJS,
'notEqual', Bool16x8NotEqualJS,
'swizzle', Bool16x8SwizzleJS,
'shuffle', Bool16x8ShuffleJS,
]);
......@@ -783,12 +623,11 @@ utils.InstallFunctions(GlobalInt8x16, DONT_ENUM, [
'splat', Int8x16Splat,
'check', Int8x16CheckJS,
'extractLane', Int8x16ExtractLaneJS,
'unsignedExtractLane', Int8x16UnsignedExtractLaneJS,
'replaceLane', Int8x16ReplaceLaneJS,
'neg', Int8x16NegJS,
'add', Int8x16AddJS,
'sub', Int8x16SubJS,
'addSaturate', Int8x16AddSaturateJS,
'subSaturate', Int8x16SubSaturateJS,
'mul', Int8x16MulJS,
'min', Int8x16MinJS,
'max', Int8x16MaxJS,
......@@ -797,6 +636,7 @@ utils.InstallFunctions(GlobalInt8x16, DONT_ENUM, [
'xor', Int8x16XorJS,
'not', Int8x16NotJS,
'shiftLeftByScalar', Int8x16ShiftLeftByScalarJS,
'shiftRightLogicalByScalar', Int8x16ShiftRightLogicalByScalarJS,
'shiftRightArithmeticByScalar', Int8x16ShiftRightArithmeticByScalarJS,
'lessThan', Int8x16LessThanJS,
'lessThanOrEqual', Int8x16LessThanOrEqualJS,
......@@ -807,52 +647,9 @@ utils.InstallFunctions(GlobalInt8x16, DONT_ENUM, [
'select', Int8x16SelectJS,
'swizzle', Int8x16SwizzleJS,
'shuffle', Int8x16ShuffleJS,
'fromUint8x16', Int8x16FromUint8x16JS,
'fromFloat32x4Bits', Int8x16FromFloat32x4BitsJS,
'fromInt32x4Bits', Int8x16FromInt32x4BitsJS,
'fromUint32x4Bits', Int8x16FromUint32x4BitsJS,
'fromInt16x8Bits', Int8x16FromInt16x8BitsJS,
'fromUint16x8Bits', Int8x16FromUint16x8BitsJS,
'fromUint8x16Bits', Int8x16FromUint8x16BitsJS,
]);
utils.InstallFunctions(GlobalUint8x16, DONT_ENUM, [
'splat', Uint8x16Splat,
'check', Uint8x16CheckJS,
'extractLane', Uint8x16ExtractLaneJS,
'replaceLane', Uint8x16ReplaceLaneJS,
'add', Uint8x16AddJS,
'sub', Uint8x16SubJS,
'addSaturate', Uint8x16AddSaturateJS,
'subSaturate', Uint8x16SubSaturateJS,
'mul', Uint8x16MulJS,
'min', Uint8x16MinJS,
'max', Uint8x16MaxJS,
'and', Uint8x16AndJS,
'or', Uint8x16OrJS,
'xor', Uint8x16XorJS,
'not', Uint8x16NotJS,
'shiftLeftByScalar', Uint8x16ShiftLeftByScalarJS,
'shiftRightLogicalByScalar', Uint8x16ShiftRightLogicalByScalarJS,
'horizontalSum', Uint8x16HorizontalSumJS,
'absoluteDifference', Uint8x16AbsoluteDifferenceJS,
'widenedAbsoluteDifference', Uint8x16WidenedAbsoluteDifferenceJS,
'lessThan', Uint8x16LessThanJS,
'lessThanOrEqual', Uint8x16LessThanOrEqualJS,
'greaterThan', Uint8x16GreaterThanJS,
'greaterThanOrEqual', Uint8x16GreaterThanOrEqualJS,
'equal', Uint8x16EqualJS,
'notEqual', Uint8x16NotEqualJS,
'select', Uint8x16SelectJS,
'swizzle', Uint8x16SwizzleJS,
'shuffle', Uint8x16ShuffleJS,
'fromInt8x16', Uint8x16FromInt8x16JS,
'fromFloat32x4Bits', Uint8x16FromFloat32x4BitsJS,
'fromInt32x4Bits', Uint8x16FromInt32x4BitsJS,
'fromUint32x4Bits', Uint8x16FromUint32x4BitsJS,
'fromInt16x8Bits', Uint8x16FromInt16x8BitsJS,
'fromUint16x8Bits', Uint8x16FromUint16x8BitsJS,
'fromInt8x16Bits', Uint8x16FromInt8x16BitsJS,
]);
utils.InstallFunctions(GlobalBool8x16, DONT_ENUM, [
......@@ -866,6 +663,8 @@ utils.InstallFunctions(GlobalBool8x16, DONT_ENUM, [
'not', Bool8x16NotJS,
'anyTrue', Bool8x16AnyTrueJS,
'allTrue', Bool8x16AllTrueJS,
'equal', Bool8x16EqualJS,
'notEqual', Bool8x16NotEqualJS,
'swizzle', Bool8x16SwizzleJS,
'shuffle', Bool8x16ShuffleJS,
]);
......@@ -873,13 +672,10 @@ utils.InstallFunctions(GlobalBool8x16, DONT_ENUM, [
utils.Export(function(to) {
to.Float32x4ToString = Float32x4ToString;
to.Int32x4ToString = Int32x4ToString;
to.Uint32x4ToString = Uint32x4ToString;
to.Bool32x4ToString = Bool32x4ToString;
to.Int16x8ToString = Int16x8ToString;
to.Uint16x8ToString = Uint16x8ToString;
to.Bool16x8ToString = Bool16x8ToString;
to.Int8x16ToString = Int8x16ToString;
to.Uint8x16ToString = Uint8x16ToString;
to.Bool8x16ToString = Bool8x16ToString;
});
......
......@@ -46,13 +46,10 @@ namespace internal {
V(Map, mutable_heap_number_map, MutableHeapNumberMap) \
V(Map, float32x4_map, Float32x4Map) \
V(Map, int32x4_map, Int32x4Map) \
V(Map, uint32x4_map, Uint32x4Map) \
V(Map, bool32x4_map, Bool32x4Map) \
V(Map, int16x8_map, Int16x8Map) \
V(Map, uint16x8_map, Uint16x8Map) \
V(Map, bool16x8_map, Bool16x8Map) \
V(Map, int8x16_map, Int8x16Map) \
V(Map, uint8x16_map, Uint8x16Map) \
V(Map, bool8x16_map, Bool8x16Map) \
V(Map, native_context_map, NativeContextMap) \
V(Map, fixed_array_map, FixedArrayMap) \
......@@ -224,20 +221,14 @@ namespace internal {
V(Float32x4_string, "Float32x4") \
V(int32x4_string, "int32x4") \
V(Int32x4_string, "Int32x4") \
V(uint32x4_string, "uint32x4") \
V(Uint32x4_string, "Uint32x4") \
V(bool32x4_string, "bool32x4") \
V(Bool32x4_string, "Bool32x4") \
V(int16x8_string, "int16x8") \
V(Int16x8_string, "Int16x8") \
V(uint16x8_string, "uint16x8") \
V(Uint16x8_string, "Uint16x8") \
V(bool16x8_string, "bool16x8") \
V(Bool16x8_string, "Bool16x8") \
V(int8x16_string, "int8x16") \
V(Int8x16_string, "Int8x16") \
V(uint8x16_string, "uint8x16") \
V(Uint8x16_string, "Uint8x16") \
V(bool8x16_string, "bool8x16") \
V(Bool8x16_string, "Bool8x16") \
V(function_string, "function") \
......@@ -378,13 +369,10 @@ namespace internal {
V(MutableHeapNumberMap) \
V(Float32x4Map) \
V(Int32x4Map) \
V(Uint32x4Map) \
V(Bool32x4Map) \
V(Int16x8Map) \
V(Uint16x8Map) \
V(Bool16x8Map) \
V(Int8x16Map) \
V(Uint8x16Map) \
V(Bool8x16Map) \
V(NativeContextMap) \
V(FixedArrayMap) \
......
......@@ -48,16 +48,6 @@ var StringCharAt;
var StringIndexOf;
var StringSubstring;
var ToString;
var Float32x4ToString;
var Int32x4ToString;
var Uint32x4ToString;
var Bool32x4ToString;
var Int16x8ToString;
var Uint16x8ToString;
var Bool16x8ToString;
var Int8x16ToString;
var Uint8x16ToString;
var Bool8x16ToString;
utils.Import(function(from) {
ArrayJoin = from.ArrayJoin;
......@@ -74,16 +64,6 @@ utils.Import(function(from) {
StringCharAt = from.StringCharAt;
StringIndexOf = from.StringIndexOf;
StringSubstring = from.StringSubstring;
Float32x4ToString = from.Float32x4ToString;
Int32x4ToString = from.Int32x4ToString;
Uint32x4ToString = from.Uint32x4ToString;
Bool32x4ToString = from.Bool32x4ToString;
Int16x8ToString = from.Int16x8ToString;
Uint16x8ToString = from.Uint16x8ToString;
Bool16x8ToString = from.Bool16x8ToString;
Int8x16ToString = from.Int8x16ToString;
Uint8x16ToString = from.Uint8x16ToString;
Bool8x16ToString = from.Bool8x16ToString;
});
utils.ImportNow(function(from) {
......@@ -127,14 +107,11 @@ function NoSideEffectToString(obj) {
switch (typeof(obj)) {
case 'float32x4': return %_CallFunction(obj, Float32x4ToString);
case 'int32x4': return %_CallFunction(obj, Int32x4ToString);
case 'uint32x4': return %_CallFunction(obj, Uint32x4ToString);
case 'bool32x4': return %_CallFunction(obj, Bool32x4ToString);
case 'int16x8': return %_CallFunction(obj, Int16x8ToString);
case 'uint16x8': return %_CallFunction(obj, Uint16x8ToString);
case 'bool16x8': return %_CallFunction(obj, Bool16x8ToString);
case 'int8x16': return %_CallFunction(obj, Int8x16ToString);
case 'uint8x16': return %_CallFunction(obj, Uint8x16ToString);
case 'bool8x16': return %_CallFunction(obj, Bool8x16ToString);
case 'int16x8': return %_CallFunction(obj, Int16x8ToString);
case 'bool16x8': return %_CallFunction(obj, Bool16x8ToString);
}
}
if (IS_OBJECT(obj)
......
......@@ -1591,11 +1591,8 @@ SIMD128_TYPES(SIMD128_VALUE_EQUALS)
SIMD128_NUMERIC_LANE_FNS(Float32x4, float, 4, FLOAT, kFloatSize)
SIMD128_NUMERIC_LANE_FNS(Int32x4, int32_t, 4, INT32, kInt32Size)
SIMD128_NUMERIC_LANE_FNS(Uint32x4, uint32_t, 4, UINT32, kInt32Size)
SIMD128_NUMERIC_LANE_FNS(Int16x8, int16_t, 8, INT16, kShortSize)
SIMD128_NUMERIC_LANE_FNS(Uint16x8, uint16_t, 8, UINT16, kShortSize)
SIMD128_NUMERIC_LANE_FNS(Int8x16, int8_t, 16, INT8, kCharSize)
SIMD128_NUMERIC_LANE_FNS(Uint8x16, uint8_t, 16, UINT8, kCharSize)
#undef SIMD128_NUMERIC_LANE_FNS
......@@ -3330,9 +3327,6 @@ CAST_ACCESSOR(String)
CAST_ACCESSOR(StringTable)
CAST_ACCESSOR(Struct)
CAST_ACCESSOR(Symbol)
CAST_ACCESSOR(Uint16x8)
CAST_ACCESSOR(Uint32x4)
CAST_ACCESSOR(Uint8x16)
CAST_ACCESSOR(UnseededNumberDictionary)
CAST_ACCESSOR(WeakCell)
CAST_ACCESSOR(WeakFixedArray)
......
......@@ -221,11 +221,8 @@ void Float32x4::Float32x4Print(std::ostream& os) { // NOLINT
} \
}
SIMD128_INT_PRINT_FUNCTION(Int32x4, 4)
SIMD128_INT_PRINT_FUNCTION(Uint32x4, 4)
SIMD128_INT_PRINT_FUNCTION(Int16x8, 8)
SIMD128_INT_PRINT_FUNCTION(Uint16x8, 8)
SIMD128_INT_PRINT_FUNCTION(Int8x16, 16)
SIMD128_INT_PRINT_FUNCTION(Uint8x16, 16)
#undef SIMD128_INT_PRINT_FUNCTION
......
......@@ -115,13 +115,10 @@
// - Simd128Value
// - Float32x4
// - Int32x4
// - Uint32x4
// - Bool32x4
// - Int16x8
// - Uint16x8
// - Bool16x8
// - Int8x16
// - Uint8x16
// - Bool8x16
// - Cell
// - PropertyCell
......@@ -869,13 +866,10 @@ template <class C> inline bool Is(Object* obj);
V(Simd128Value) \
V(Float32x4) \
V(Int32x4) \
V(Uint32x4) \
V(Bool32x4) \
V(Int16x8) \
V(Uint16x8) \
V(Bool16x8) \
V(Int8x16) \
V(Uint8x16) \
V(Bool8x16) \
V(Name) \
V(UniqueName) \
......@@ -1598,13 +1592,10 @@ class Simd128Value : public HeapObject {
#define SIMD128_TYPES(V) \
V(FLOAT32X4, Float32x4, float32x4, 4, float) \
V(INT32X4, Int32x4, int32x4, 4, int32_t) \
V(UINT32X4, Uint32x4, uint32x4, 4, uint32_t) \
V(BOOL32X4, Bool32x4, bool32x4, 4, bool) \
V(INT16X8, Int16x8, int16x8, 8, int16_t) \
V(UINT16X8, Uint16x8, uint16x8, 8, uint16_t) \
V(BOOL16X8, Bool16x8, bool16x8, 8, bool) \
V(INT8X16, Int8x16, int8x16, 16, int8_t) \
V(UINT8X16, Uint8x16, uint8x16, 16, uint8_t) \
V(BOOL8X16, Bool8x16, bool8x16, 16, bool)
#define SIMD128_VALUE_CLASS(TYPE, Type, type, lane_count, lane_type) \
......
......@@ -21,29 +21,6 @@ namespace {
// Functions to convert Numbers to SIMD component types.
template <typename T, typename F>
static bool CanCast(F from) {
// A float can't represent 2^31 - 1 or 2^32 - 1 exactly, so promote the limits
// to double. Otherwise, the limit is truncated and numbers like 2^31 or 2^32
// get through, causing any static_cast to be undefined.
return from >= static_cast<double>(std::numeric_limits<T>::min()) &&
from <= static_cast<double>(std::numeric_limits<T>::max());
}
// Explicitly specialize for conversions to float, which always succeed.
template <>
bool CanCast<float>(int32_t from) {
return true;
}
template <>
bool CanCast<float>(uint32_t from) {
return true;
}
template <typename T>
static T ConvertNumber(double number);
......@@ -60,36 +37,18 @@ int32_t ConvertNumber<int32_t>(double number) {
}
template <>
uint32_t ConvertNumber<uint32_t>(double number) {
return DoubleToUint32(number);
}
template <>
int16_t ConvertNumber<int16_t>(double number) {
return static_cast<int16_t>(DoubleToInt32(number));
}
template <>
uint16_t ConvertNumber<uint16_t>(double number) {
return static_cast<uint16_t>(DoubleToUint32(number));
}
template <>
int8_t ConvertNumber<int8_t>(double number) {
return static_cast<int8_t>(DoubleToInt32(number));
}
template <>
uint8_t ConvertNumber<uint8_t>(double number) {
return static_cast<uint8_t>(DoubleToUint32(number));
}
// TODO(bbudge): Make this consistent with SIMD instruction results.
inline float RecipApprox(float a) { return 1.0f / a; }
......@@ -110,14 +69,6 @@ inline T AddSaturate(T a, T b) {
}
// Widening absolute difference for uint16_t and uint8_t.
template <typename T>
inline uint32_t AbsoluteDifference(T a, T b) {
uint32_t result = std::abs(a - b);
return result;
}
// Saturating subtraction for int16_t and int8_t.
template <typename T>
inline T SubSaturate(T a, T b) {
......@@ -159,6 +110,15 @@ inline float MaxNumber(float a, float b) {
return Max(a, b);
}
inline bool CanCast(int32_t a) { return true; }
inline bool CanCast(float a) {
return a > std::numeric_limits<int32_t>::min() &&
a < std::numeric_limits<int32_t>::max();
}
} // namespace
//-------------------------------------------------------------------
......@@ -283,13 +243,10 @@ RUNTIME_FUNCTION(Runtime_SimdSameValueZero) {
#define SIMD_ALL_TYPES(FUNCTION) \
FUNCTION(Float32x4, float, 4, NewNumber, GET_NUMERIC_ARG) \
FUNCTION(Int32x4, int32_t, 4, NewNumber, GET_NUMERIC_ARG) \
FUNCTION(Uint32x4, uint32_t, 4, NewNumber, GET_NUMERIC_ARG) \
FUNCTION(Bool32x4, bool, 4, ToBoolean, GET_BOOLEAN_ARG) \
FUNCTION(Int16x8, int16_t, 8, NewNumber, GET_NUMERIC_ARG) \
FUNCTION(Uint16x8, uint16_t, 8, NewNumber, GET_NUMERIC_ARG) \
FUNCTION(Bool16x8, bool, 8, ToBoolean, GET_BOOLEAN_ARG) \
FUNCTION(Int8x16, int8_t, 16, NewNumber, GET_NUMERIC_ARG) \
FUNCTION(Uint8x16, uint8_t, 16, NewNumber, GET_NUMERIC_ARG) \
FUNCTION(Bool8x16, bool, 16, ToBoolean, GET_BOOLEAN_ARG)
#define SIMD_CREATE_FUNCTION(type, lane_type, lane_count, extract, replace) \
......@@ -446,11 +403,6 @@ SIMD_MAXNUM_FUNCTION(Float32x4, float, 4)
FUNCTION(Int16x8, int16_t, 16, 8) \
FUNCTION(Int8x16, int8_t, 8, 16)
#define SIMD_UINT_TYPES(FUNCTION) \
FUNCTION(Uint32x4, uint32_t, 32, 4) \
FUNCTION(Uint16x8, uint16_t, 16, 8) \
FUNCTION(Uint8x16, uint8_t, 8, 16)
#define CONVERT_SHIFT_ARG_CHECKED(name, index) \
RUNTIME_ASSERT(args[index]->IsNumber()); \
int32_t signed_shift = 0; \
......@@ -485,7 +437,7 @@ SIMD_MAXNUM_FUNCTION(Float32x4, float, 4)
if (shift < lane_bits) { \
for (int i = 0; i < kLaneCount; i++) { \
lanes[i] = static_cast<lane_type>( \
bit_cast<lane_type>(a->get_lane(i)) >> shift); \
bit_cast<u##lane_type>(a->get_lane(i)) >> shift); \
} \
} \
Handle<type> result = isolate->factory()->New##type(lanes); \
......@@ -509,23 +461,9 @@ SIMD_MAXNUM_FUNCTION(Float32x4, float, 4)
return *result; \
}
#define SIMD_HORIZONTAL_SUM_FUNCTION(type, lane_type, lane_bits, lane_count) \
RUNTIME_FUNCTION(Runtime_##type##HorizontalSum) { \
HandleScope scope(isolate); \
DCHECK(args.length() == 1); \
CONVERT_ARG_HANDLE_CHECKED(type, a, 0); \
double sum = 0; \
for (int i = 0; i < lane_count; i++) { \
sum += a->get_lane(i); \
} \
return *isolate->factory()->NewNumber(sum); \
}
SIMD_INT_TYPES(SIMD_LSL_FUNCTION)
SIMD_UINT_TYPES(SIMD_LSL_FUNCTION)
SIMD_INT_TYPES(SIMD_LSR_FUNCTION)
SIMD_INT_TYPES(SIMD_ASR_FUNCTION)
SIMD_UINT_TYPES(SIMD_LSR_FUNCTION)
SIMD_UINT_TYPES(SIMD_HORIZONTAL_SUM_FUNCTION)
//-------------------------------------------------------------------
......@@ -575,9 +513,7 @@ SIMD_BOOL_TYPES(SIMD_ALL_FUNCTION)
#define SIMD_SMALL_INT_TYPES(FUNCTION) \
FUNCTION(Int16x8, int16_t, 8) \
FUNCTION(Uint16x8, uint16_t, 8) \
FUNCTION(Int8x16, int8_t, 16) \
FUNCTION(Uint8x16, uint8_t, 16)
FUNCTION(Int8x16, int8_t, 16)
#define SIMD_ADD_SATURATE_FUNCTION(type, lane_type, lane_count) \
RUNTIME_FUNCTION(Runtime_##type##AddSaturate) { \
......@@ -599,51 +535,20 @@ SIMD_SMALL_INT_TYPES(SIMD_SUB_SATURATE_FUNCTION)
//-------------------------------------------------------------------
// Small Unsigned int-only functions.
#define SIMD_SMALL_UINT_TYPES(FUNCTION) \
FUNCTION(Uint16x8, uint16_t, 8, Uint32x4, uint32_t) \
FUNCTION(Uint8x16, uint8_t, 16, Uint16x8, uint16_t)
#define SIMD_ABS_DIFF_FUNCTION(type, lane_type, lane_count, wide_type, \
wide_ctype) \
RUNTIME_FUNCTION(Runtime_##type##AbsoluteDifference) { \
HandleScope scope(isolate); \
SIMD_BINARY_OP(type, lane_type, lane_count, AbsoluteDifference, result); \
return *result; \
}
#define SIMD_WIDE_ABS_DIFF_FUNCTION(type, lane_type, lane_count, wide_type, \
wide_ctype) \
RUNTIME_FUNCTION(Runtime_##type##WidenedAbsoluteDifference) { \
HandleScope scope(isolate); \
static const int kLaneCount = lane_count / 2; \
DCHECK(args.length() == 2); \
CONVERT_ARG_HANDLE_CHECKED(type, a, 0); \
CONVERT_ARG_HANDLE_CHECKED(type, b, 1); \
wide_ctype lanes[kLaneCount]; \
for (int i = 0; i < kLaneCount; i++) { \
lanes[i] = AbsoluteDifference(a->get_lane(i), b->get_lane(i)); \
} \
Handle<wide_type> result = isolate->factory()->New##wide_type(lanes); \
return *result; \
}
SIMD_SMALL_UINT_TYPES(SIMD_ABS_DIFF_FUNCTION)
SIMD_SMALL_UINT_TYPES(SIMD_WIDE_ABS_DIFF_FUNCTION)
//-------------------------------------------------------------------
// Numeric functions.
#define SIMD_NUMERIC_TYPES(FUNCTION) \
FUNCTION(Float32x4, float, 4) \
FUNCTION(Int32x4, int32_t, 4) \
FUNCTION(Uint32x4, uint32_t, 4) \
FUNCTION(Int16x8, int16_t, 8) \
FUNCTION(Uint16x8, uint16_t, 8) \
FUNCTION(Int8x16, int8_t, 16) \
FUNCTION(Uint8x16, uint8_t, 16)
FUNCTION(Int8x16, int8_t, 16)
#define SIMD_NEG_FUNCTION(type, lane_type, lane_count) \
RUNTIME_FUNCTION(Runtime_##type##Neg) { \
HandleScope scope(isolate); \
SIMD_UNARY_OP(type, lane_type, lane_count, -, result); \
return *result; \
}
#define BINARY_ADD(a, b) (a) + (b)
#define SIMD_ADD_FUNCTION(type, lane_type, lane_count) \
......@@ -683,6 +588,7 @@ SIMD_SMALL_UINT_TYPES(SIMD_WIDE_ABS_DIFF_FUNCTION)
return *result; \
}
SIMD_NUMERIC_TYPES(SIMD_NEG_FUNCTION)
SIMD_NUMERIC_TYPES(SIMD_ADD_FUNCTION)
SIMD_NUMERIC_TYPES(SIMD_SUB_FUNCTION)
SIMD_NUMERIC_TYPES(SIMD_MUL_FUNCTION)
......@@ -696,11 +602,8 @@ SIMD_NUMERIC_TYPES(SIMD_MAX_FUNCTION)
#define SIMD_RELATIONAL_TYPES(FUNCTION) \
FUNCTION(Float32x4, Bool32x4, 4) \
FUNCTION(Int32x4, Bool32x4, 4) \
FUNCTION(Uint32x4, Bool32x4, 4) \
FUNCTION(Int16x8, Bool16x8, 8) \
FUNCTION(Uint16x8, Bool16x8, 8) \
FUNCTION(Int8x16, Bool8x16, 16) \
FUNCTION(Uint8x16, Bool8x16, 16)
FUNCTION(Int8x16, Bool8x16, 16)
#define SIMD_EQUALITY_TYPES(FUNCTION) \
SIMD_RELATIONAL_TYPES(FUNCTION) \
......@@ -764,11 +667,8 @@ SIMD_RELATIONAL_TYPES(SIMD_GREATER_THAN_OR_EQUAL_FUNCTION)
#define SIMD_LOGICAL_TYPES(FUNCTION) \
FUNCTION(Int32x4, int32_t, 4, _INT) \
FUNCTION(Uint32x4, uint32_t, 4, _INT) \
FUNCTION(Int16x8, int16_t, 8, _INT) \
FUNCTION(Uint16x8, uint16_t, 8, _INT) \
FUNCTION(Int8x16, int8_t, 16, _INT) \
FUNCTION(Uint8x16, uint8_t, 16, _INT) \
FUNCTION(Bool32x4, bool, 4, _BOOL) \
FUNCTION(Bool16x8, bool, 8, _BOOL) \
FUNCTION(Bool8x16, bool, 16, _BOOL)
......@@ -821,11 +721,8 @@ SIMD_LOGICAL_TYPES(SIMD_NOT_FUNCTION)
#define SIMD_SELECT_TYPES(FUNCTION) \
FUNCTION(Float32x4, float, Bool32x4, 4) \
FUNCTION(Int32x4, int32_t, Bool32x4, 4) \
FUNCTION(Uint32x4, uint32_t, Bool32x4, 4) \
FUNCTION(Int16x8, int16_t, Bool16x8, 8) \
FUNCTION(Uint16x8, uint16_t, Bool16x8, 8) \
FUNCTION(Int8x16, int8_t, Bool8x16, 16) \
FUNCTION(Uint8x16, uint8_t, Bool8x16, 16)
FUNCTION(Int8x16, int8_t, Bool8x16, 16)
#define SIMD_SELECT_FUNCTION(type, lane_type, bool_type, lane_count) \
RUNTIME_FUNCTION(Runtime_##type##Select) { \
......@@ -847,38 +744,11 @@ SIMD_SELECT_TYPES(SIMD_SELECT_FUNCTION)
//-------------------------------------------------------------------
// Signed / unsigned functions.
#define SIMD_SIGNED_TYPES(FUNCTION) \
FUNCTION(Float32x4, float, 4) \
FUNCTION(Int32x4, int32_t, 4) \
FUNCTION(Int16x8, int16_t, 8) \
FUNCTION(Int8x16, int8_t, 16)
#define SIMD_NEG_FUNCTION(type, lane_type, lane_count) \
RUNTIME_FUNCTION(Runtime_##type##Neg) { \
HandleScope scope(isolate); \
SIMD_UNARY_OP(type, lane_type, lane_count, -, result); \
return *result; \
}
SIMD_SIGNED_TYPES(SIMD_NEG_FUNCTION)
//-------------------------------------------------------------------
// Casting functions.
#define SIMD_FROM_TYPES(FUNCTION) \
FUNCTION(Float32x4, float, 4, Int32x4, int32_t) \
FUNCTION(Float32x4, float, 4, Uint32x4, uint32_t) \
FUNCTION(Int32x4, int32_t, 4, Float32x4, float) \
FUNCTION(Int32x4, int32_t, 4, Uint32x4, uint32_t) \
FUNCTION(Uint32x4, uint32_t, 4, Float32x4, float) \
FUNCTION(Uint32x4, uint32_t, 4, Int32x4, int32_t) \
FUNCTION(Int16x8, int16_t, 8, Uint16x8, uint16_t) \
FUNCTION(Uint16x8, uint16_t, 8, Int16x8, int16_t) \
FUNCTION(Int8x16, int8_t, 16, Uint8x16, uint8_t) \
FUNCTION(Uint8x16, uint8_t, 16, Int8x16, int8_t)
FUNCTION(Int32x4, int32_t, 4, Float32x4, float)
#define SIMD_FROM_FUNCTION(type, lane_type, lane_count, from_type, from_ctype) \
RUNTIME_FUNCTION(Runtime_##type##From##from_type) { \
......@@ -889,8 +759,7 @@ SIMD_SIGNED_TYPES(SIMD_NEG_FUNCTION)
lane_type lanes[kLaneCount]; \
for (int i = 0; i < kLaneCount; i++) { \
from_ctype a_value = a->get_lane(i); \
if (a_value != a_value) a_value = 0; \
RUNTIME_ASSERT(CanCast<lane_type>(a_value)); \
RUNTIME_ASSERT(CanCast(a_value)); \
lanes[i] = static_cast<lane_type>(a_value); \
} \
Handle<type> result = isolate->factory()->New##type(lanes); \
......@@ -901,47 +770,17 @@ SIMD_FROM_TYPES(SIMD_FROM_FUNCTION)
#define SIMD_FROM_BITS_TYPES(FUNCTION) \
FUNCTION(Float32x4, float, 4, Int32x4) \
FUNCTION(Float32x4, float, 4, Uint32x4) \
FUNCTION(Float32x4, float, 4, Int16x8) \
FUNCTION(Float32x4, float, 4, Uint16x8) \
FUNCTION(Float32x4, float, 4, Int8x16) \
FUNCTION(Float32x4, float, 4, Uint8x16) \
FUNCTION(Int32x4, int32_t, 4, Float32x4) \
FUNCTION(Int32x4, int32_t, 4, Uint32x4) \
FUNCTION(Int32x4, int32_t, 4, Int16x8) \
FUNCTION(Int32x4, int32_t, 4, Uint16x8) \
FUNCTION(Int32x4, int32_t, 4, Int8x16) \
FUNCTION(Int32x4, int32_t, 4, Uint8x16) \
FUNCTION(Uint32x4, uint32_t, 4, Float32x4) \
FUNCTION(Uint32x4, uint32_t, 4, Int32x4) \
FUNCTION(Uint32x4, uint32_t, 4, Int16x8) \
FUNCTION(Uint32x4, uint32_t, 4, Uint16x8) \
FUNCTION(Uint32x4, uint32_t, 4, Int8x16) \
FUNCTION(Uint32x4, uint32_t, 4, Uint8x16) \
FUNCTION(Int16x8, int16_t, 8, Float32x4) \
FUNCTION(Int16x8, int16_t, 8, Int32x4) \
FUNCTION(Int16x8, int16_t, 8, Uint32x4) \
FUNCTION(Int16x8, int16_t, 8, Uint16x8) \
FUNCTION(Int16x8, int16_t, 8, Int8x16) \
FUNCTION(Int16x8, int16_t, 8, Uint8x16) \
FUNCTION(Uint16x8, uint16_t, 8, Float32x4) \
FUNCTION(Uint16x8, uint16_t, 8, Int32x4) \
FUNCTION(Uint16x8, uint16_t, 8, Uint32x4) \
FUNCTION(Uint16x8, uint16_t, 8, Int16x8) \
FUNCTION(Uint16x8, uint16_t, 8, Int8x16) \
FUNCTION(Uint16x8, uint16_t, 8, Uint8x16) \
FUNCTION(Int8x16, int8_t, 16, Float32x4) \
FUNCTION(Int8x16, int8_t, 16, Int32x4) \
FUNCTION(Int8x16, int8_t, 16, Uint32x4) \
FUNCTION(Int8x16, int8_t, 16, Int16x8) \
FUNCTION(Int8x16, int8_t, 16, Uint16x8) \
FUNCTION(Int8x16, int8_t, 16, Uint8x16) \
FUNCTION(Uint8x16, uint8_t, 16, Float32x4) \
FUNCTION(Uint8x16, uint8_t, 16, Int32x4) \
FUNCTION(Uint8x16, uint8_t, 16, Uint32x4) \
FUNCTION(Uint8x16, uint8_t, 16, Int16x8) \
FUNCTION(Uint8x16, uint8_t, 16, Uint16x8) \
FUNCTION(Uint8x16, uint8_t, 16, Int8x16)
FUNCTION(Int8x16, int8_t, 16, Int16x8)
#define SIMD_FROM_BITS_FUNCTION(type, lane_type, lane_count, from_type) \
RUNTIME_FUNCTION(Runtime_##type##From##from_type##Bits) { \
......@@ -957,5 +796,26 @@ SIMD_FROM_TYPES(SIMD_FROM_FUNCTION)
SIMD_FROM_BITS_TYPES(SIMD_FROM_BITS_FUNCTION)
//-------------------------------------------------------------------
// Unsigned extract functions.
// TODO(bbudge): remove when spec changes to include unsigned int types.
RUNTIME_FUNCTION(Runtime_Int16x8UnsignedExtractLane) {
HandleScope scope(isolate);
DCHECK(args.length() == 2);
CONVERT_ARG_HANDLE_CHECKED(Int16x8, a, 0);
CONVERT_SIMD_LANE_ARG_CHECKED(lane, 1, 8);
return *isolate->factory()->NewNumber(bit_cast<uint16_t>(a->get_lane(lane)));
}
RUNTIME_FUNCTION(Runtime_Int8x16UnsignedExtractLane) {
HandleScope scope(isolate);
DCHECK(args.length() == 2);
CONVERT_ARG_HANDLE_CHECKED(Int8x16, a, 0);
CONVERT_SIMD_LANE_ARG_CHECKED(lane, 1, 16);
return *isolate->factory()->NewNumber(bit_cast<uint8_t>(a->get_lane(lane)));
}
} // namespace internal
} // namespace v8
......@@ -572,13 +572,10 @@ namespace internal {
F(SimdSameValueZero, 2, 1) \
F(CreateFloat32x4, 4, 1) \
F(CreateInt32x4, 4, 1) \
F(CreateUint32x4, 4, 1) \
F(CreateBool32x4, 4, 1) \
F(CreateInt16x8, 8, 1) \
F(CreateUint16x8, 8, 1) \
F(CreateBool16x8, 8, 1) \
F(CreateInt8x16, 16, 1) \
F(CreateUint8x16, 16, 1) \
F(CreateBool8x16, 16, 1) \
F(Float32x4Check, 1, 1) \
F(Float32x4ExtractLane, 2, 1) \
......@@ -596,23 +593,19 @@ namespace internal {
F(Float32x4Max, 2, 1) \
F(Float32x4MinNum, 2, 1) \
F(Float32x4MaxNum, 2, 1) \
F(Float32x4Equal, 2, 1) \
F(Float32x4NotEqual, 2, 1) \
F(Float32x4LessThan, 2, 1) \
F(Float32x4LessThanOrEqual, 2, 1) \
F(Float32x4GreaterThan, 2, 1) \
F(Float32x4GreaterThanOrEqual, 2, 1) \
F(Float32x4Equal, 2, 1) \
F(Float32x4NotEqual, 2, 1) \
F(Float32x4Select, 3, 1) \
F(Float32x4Swizzle, 5, 1) \
F(Float32x4Shuffle, 6, 1) \
F(Float32x4FromInt32x4, 1, 1) \
F(Float32x4FromUint32x4, 1, 1) \
F(Float32x4FromInt32x4Bits, 1, 1) \
F(Float32x4FromUint32x4Bits, 1, 1) \
F(Float32x4FromInt16x8Bits, 1, 1) \
F(Float32x4FromUint16x8Bits, 1, 1) \
F(Float32x4FromInt8x16Bits, 1, 1) \
F(Float32x4FromUint8x16Bits, 1, 1) \
F(Int32x4Check, 1, 1) \
F(Int32x4ExtractLane, 2, 1) \
F(Int32x4ReplaceLane, 3, 1) \
......@@ -627,56 +620,21 @@ namespace internal {
F(Int32x4Xor, 2, 1) \
F(Int32x4Not, 1, 1) \
F(Int32x4ShiftLeftByScalar, 2, 1) \
F(Int32x4ShiftRightLogicalByScalar, 2, 1) \
F(Int32x4ShiftRightArithmeticByScalar, 2, 1) \
F(Int32x4Equal, 2, 1) \
F(Int32x4NotEqual, 2, 1) \
F(Int32x4LessThan, 2, 1) \
F(Int32x4LessThanOrEqual, 2, 1) \
F(Int32x4GreaterThan, 2, 1) \
F(Int32x4GreaterThanOrEqual, 2, 1) \
F(Int32x4Equal, 2, 1) \
F(Int32x4NotEqual, 2, 1) \
F(Int32x4Select, 3, 1) \
F(Int32x4Swizzle, 5, 1) \
F(Int32x4Shuffle, 6, 1) \
F(Int32x4FromFloat32x4, 1, 1) \
F(Int32x4FromUint32x4, 1, 1) \
F(Int32x4FromFloat32x4Bits, 1, 1) \
F(Int32x4FromUint32x4Bits, 1, 1) \
F(Int32x4FromInt16x8Bits, 1, 1) \
F(Int32x4FromUint16x8Bits, 1, 1) \
F(Int32x4FromInt8x16Bits, 1, 1) \
F(Int32x4FromUint8x16Bits, 1, 1) \
F(Uint32x4Check, 1, 1) \
F(Uint32x4ExtractLane, 2, 1) \
F(Uint32x4ReplaceLane, 3, 1) \
F(Uint32x4Add, 2, 1) \
F(Uint32x4Sub, 2, 1) \
F(Uint32x4Mul, 2, 1) \
F(Uint32x4Min, 2, 1) \
F(Uint32x4Max, 2, 1) \
F(Uint32x4And, 2, 1) \
F(Uint32x4Or, 2, 1) \
F(Uint32x4Xor, 2, 1) \
F(Uint32x4Not, 1, 1) \
F(Uint32x4ShiftLeftByScalar, 2, 1) \
F(Uint32x4ShiftRightLogicalByScalar, 2, 1) \
F(Uint32x4HorizontalSum, 1, 1) \
F(Uint32x4Equal, 2, 1) \
F(Uint32x4NotEqual, 2, 1) \
F(Uint32x4LessThan, 2, 1) \
F(Uint32x4LessThanOrEqual, 2, 1) \
F(Uint32x4GreaterThan, 2, 1) \
F(Uint32x4GreaterThanOrEqual, 2, 1) \
F(Uint32x4Select, 3, 1) \
F(Uint32x4Swizzle, 5, 1) \
F(Uint32x4Shuffle, 6, 1) \
F(Uint32x4FromFloat32x4, 1, 1) \
F(Uint32x4FromInt32x4, 1, 1) \
F(Uint32x4FromFloat32x4Bits, 1, 1) \
F(Uint32x4FromInt32x4Bits, 1, 1) \
F(Uint32x4FromInt16x8Bits, 1, 1) \
F(Uint32x4FromUint16x8Bits, 1, 1) \
F(Uint32x4FromInt8x16Bits, 1, 1) \
F(Uint32x4FromUint8x16Bits, 1, 1) \
F(Bool32x4Check, 1, 1) \
F(Bool32x4ExtractLane, 2, 1) \
F(Bool32x4ReplaceLane, 3, 1) \
......@@ -686,10 +644,13 @@ namespace internal {
F(Bool32x4Not, 1, 1) \
F(Bool32x4AnyTrue, 1, 1) \
F(Bool32x4AllTrue, 1, 1) \
F(Bool32x4Equal, 2, 1) \
F(Bool32x4NotEqual, 2, 1) \
F(Bool32x4Swizzle, 5, 1) \
F(Bool32x4Shuffle, 6, 1) \
F(Int16x8Check, 1, 1) \
F(Int16x8ExtractLane, 2, 1) \
F(Int16x8UnsignedExtractLane, 2, 1) \
F(Int16x8ReplaceLane, 3, 1) \
F(Int16x8Neg, 1, 1) \
F(Int16x8Add, 2, 1) \
......@@ -704,58 +665,20 @@ namespace internal {
F(Int16x8Xor, 2, 1) \
F(Int16x8Not, 1, 1) \
F(Int16x8ShiftLeftByScalar, 2, 1) \
F(Int16x8ShiftRightLogicalByScalar, 2, 1) \
F(Int16x8ShiftRightArithmeticByScalar, 2, 1) \
F(Int16x8Equal, 2, 1) \
F(Int16x8NotEqual, 2, 1) \
F(Int16x8LessThan, 2, 1) \
F(Int16x8LessThanOrEqual, 2, 1) \
F(Int16x8GreaterThan, 2, 1) \
F(Int16x8GreaterThanOrEqual, 2, 1) \
F(Int16x8Equal, 2, 1) \
F(Int16x8NotEqual, 2, 1) \
F(Int16x8Select, 3, 1) \
F(Int16x8Swizzle, 9, 1) \
F(Int16x8Shuffle, 10, 1) \
F(Int16x8FromUint16x8, 1, 1) \
F(Int16x8FromFloat32x4Bits, 1, 1) \
F(Int16x8FromInt32x4Bits, 1, 1) \
F(Int16x8FromUint32x4Bits, 1, 1) \
F(Int16x8FromUint16x8Bits, 1, 1) \
F(Int16x8FromInt8x16Bits, 1, 1) \
F(Int16x8FromUint8x16Bits, 1, 1) \
F(Uint16x8Check, 1, 1) \
F(Uint16x8ExtractLane, 2, 1) \
F(Uint16x8ReplaceLane, 3, 1) \
F(Uint16x8Add, 2, 1) \
F(Uint16x8AddSaturate, 2, 1) \
F(Uint16x8Sub, 2, 1) \
F(Uint16x8SubSaturate, 2, 1) \
F(Uint16x8Mul, 2, 1) \
F(Uint16x8Min, 2, 1) \
F(Uint16x8Max, 2, 1) \
F(Uint16x8And, 2, 1) \
F(Uint16x8Or, 2, 1) \
F(Uint16x8Xor, 2, 1) \
F(Uint16x8Not, 1, 1) \
F(Uint16x8ShiftLeftByScalar, 2, 1) \
F(Uint16x8ShiftRightLogicalByScalar, 2, 1) \
F(Uint16x8HorizontalSum, 1, 1) \
F(Uint16x8AbsoluteDifference, 2, 1) \
F(Uint16x8WidenedAbsoluteDifference, 2, 1) \
F(Uint16x8Equal, 2, 1) \
F(Uint16x8NotEqual, 2, 1) \
F(Uint16x8LessThan, 2, 1) \
F(Uint16x8LessThanOrEqual, 2, 1) \
F(Uint16x8GreaterThan, 2, 1) \
F(Uint16x8GreaterThanOrEqual, 2, 1) \
F(Uint16x8Select, 3, 1) \
F(Uint16x8Swizzle, 9, 1) \
F(Uint16x8Shuffle, 10, 1) \
F(Uint16x8FromInt16x8, 1, 1) \
F(Uint16x8FromFloat32x4Bits, 1, 1) \
F(Uint16x8FromInt32x4Bits, 1, 1) \
F(Uint16x8FromUint32x4Bits, 1, 1) \
F(Uint16x8FromInt16x8Bits, 1, 1) \
F(Uint16x8FromInt8x16Bits, 1, 1) \
F(Uint16x8FromUint8x16Bits, 1, 1) \
F(Bool16x8Check, 1, 1) \
F(Bool16x8ExtractLane, 2, 1) \
F(Bool16x8ReplaceLane, 3, 1) \
......@@ -765,10 +688,13 @@ namespace internal {
F(Bool16x8Not, 1, 1) \
F(Bool16x8AnyTrue, 1, 1) \
F(Bool16x8AllTrue, 1, 1) \
F(Bool16x8Equal, 2, 1) \
F(Bool16x8NotEqual, 2, 1) \
F(Bool16x8Swizzle, 9, 1) \
F(Bool16x8Shuffle, 10, 1) \
F(Int8x16Check, 1, 1) \
F(Int8x16ExtractLane, 2, 1) \
F(Int8x16UnsignedExtractLane, 2, 1) \
F(Int8x16ReplaceLane, 3, 1) \
F(Int8x16Neg, 1, 1) \
F(Int8x16Add, 2, 1) \
......@@ -783,58 +709,20 @@ namespace internal {
F(Int8x16Xor, 2, 1) \
F(Int8x16Not, 1, 1) \
F(Int8x16ShiftLeftByScalar, 2, 1) \
F(Int8x16ShiftRightLogicalByScalar, 2, 1) \
F(Int8x16ShiftRightArithmeticByScalar, 2, 1) \
F(Int8x16Equal, 2, 1) \
F(Int8x16NotEqual, 2, 1) \
F(Int8x16LessThan, 2, 1) \
F(Int8x16LessThanOrEqual, 2, 1) \
F(Int8x16GreaterThan, 2, 1) \
F(Int8x16GreaterThanOrEqual, 2, 1) \
F(Int8x16Equal, 2, 1) \
F(Int8x16NotEqual, 2, 1) \
F(Int8x16Select, 3, 1) \
F(Int8x16Swizzle, 17, 1) \
F(Int8x16Shuffle, 18, 1) \
F(Int8x16FromUint8x16, 1, 1) \
F(Int8x16FromFloat32x4Bits, 1, 1) \
F(Int8x16FromInt32x4Bits, 1, 1) \
F(Int8x16FromUint32x4Bits, 1, 1) \
F(Int8x16FromInt16x8Bits, 1, 1) \
F(Int8x16FromUint16x8Bits, 1, 1) \
F(Int8x16FromUint8x16Bits, 1, 1) \
F(Uint8x16Check, 1, 1) \
F(Uint8x16ExtractLane, 2, 1) \
F(Uint8x16ReplaceLane, 3, 1) \
F(Uint8x16Add, 2, 1) \
F(Uint8x16AddSaturate, 2, 1) \
F(Uint8x16Sub, 2, 1) \
F(Uint8x16SubSaturate, 2, 1) \
F(Uint8x16Mul, 2, 1) \
F(Uint8x16Min, 2, 1) \
F(Uint8x16Max, 2, 1) \
F(Uint8x16And, 2, 1) \
F(Uint8x16Or, 2, 1) \
F(Uint8x16Xor, 2, 1) \
F(Uint8x16Not, 1, 1) \
F(Uint8x16ShiftLeftByScalar, 2, 1) \
F(Uint8x16ShiftRightLogicalByScalar, 2, 1) \
F(Uint8x16HorizontalSum, 1, 1) \
F(Uint8x16AbsoluteDifference, 2, 1) \
F(Uint8x16WidenedAbsoluteDifference, 2, 1) \
F(Uint8x16Equal, 2, 1) \
F(Uint8x16NotEqual, 2, 1) \
F(Uint8x16LessThan, 2, 1) \
F(Uint8x16LessThanOrEqual, 2, 1) \
F(Uint8x16GreaterThan, 2, 1) \
F(Uint8x16GreaterThanOrEqual, 2, 1) \
F(Uint8x16Select, 3, 1) \
F(Uint8x16Swizzle, 17, 1) \
F(Uint8x16Shuffle, 18, 1) \
F(Uint8x16FromInt8x16, 1, 1) \
F(Uint8x16FromFloat32x4Bits, 1, 1) \
F(Uint8x16FromInt32x4Bits, 1, 1) \
F(Uint8x16FromUint32x4Bits, 1, 1) \
F(Uint8x16FromInt16x8Bits, 1, 1) \
F(Uint8x16FromUint16x8Bits, 1, 1) \
F(Uint8x16FromInt8x16Bits, 1, 1) \
F(Bool8x16Check, 1, 1) \
F(Bool8x16ExtractLane, 2, 1) \
F(Bool8x16ReplaceLane, 3, 1) \
......@@ -844,6 +732,8 @@ namespace internal {
F(Bool8x16Not, 1, 1) \
F(Bool8x16AnyTrue, 1, 1) \
F(Bool8x16AllTrue, 1, 1) \
F(Bool8x16Equal, 2, 1) \
F(Bool8x16NotEqual, 2, 1) \
F(Bool8x16Swizzle, 17, 1) \
F(Bool8x16Shuffle, 18, 1)
......
......@@ -503,13 +503,10 @@ void CheckSimdSnapshot(const char* program, const char* var_name) {
TEST(HeapSnapshotSimd) {
CheckSimdSnapshot("a = SIMD.Float32x4();\n", "a");
CheckSimdSnapshot("a = SIMD.Int32x4();\n", "a");
CheckSimdSnapshot("a = SIMD.Uint32x4();\n", "a");
CheckSimdSnapshot("a = SIMD.Bool32x4();\n", "a");
CheckSimdSnapshot("a = SIMD.Int16x8();\n", "a");
CheckSimdSnapshot("a = SIMD.Uint16x8();\n", "a");
CheckSimdSnapshot("a = SIMD.Bool16x8();\n", "a");
CheckSimdSnapshot("a = SIMD.Int8x16();\n", "a");
CheckSimdSnapshot("a = SIMD.Uint8x16();\n", "a");
CheckSimdSnapshot("a = SIMD.Bool8x16();\n", "a");
}
......
......@@ -288,7 +288,7 @@ TEST(SimdObjects) {
}
// Int32x4
{
int32_t lanes[4] = {1, 2, 3, 4};
int32_t lanes[4] = {-1, 0, 1, 2};
Handle<Int32x4> value = factory->NewInt32x4(lanes);
CHECK(value->IsInt32x4());
......@@ -297,26 +297,12 @@ TEST(SimdObjects) {
#ifdef OBJECT_PRINT
std::ostringstream os;
value->Int32x4Print(os);
CHECK_EQ("1, 2, 3, 4", os.str());
#endif // OBJECT_PRINT
}
// Uint32x4
{
uint32_t lanes[4] = {1, 2, 3, 4};
Handle<Uint32x4> value = factory->NewUint32x4(lanes);
CHECK(value->IsUint32x4());
CheckSimdValue<Uint32x4, uint32_t, 4>(*value, lanes, 3);
#ifdef OBJECT_PRINT
std::ostringstream os;
value->Uint32x4Print(os);
CHECK_EQ("1, 2, 3, 4", os.str());
CHECK_EQ("-1, 0, 1, 2", os.str());
#endif // OBJECT_PRINT
}
// Bool32x4
{
bool lanes[4] = {true, false, true, false};
bool lanes[4] = {true, true, true, false};
Handle<Bool32x4> value = factory->NewBool32x4(lanes);
CHECK(value->IsBool32x4());
......@@ -325,12 +311,12 @@ TEST(SimdObjects) {
#ifdef OBJECT_PRINT
std::ostringstream os;
value->Bool32x4Print(os);
CHECK_EQ("true, false, true, false", os.str());
CHECK_EQ("true, true, true, false", os.str());
#endif // OBJECT_PRINT
}
// Int16x8
{
int16_t lanes[8] = {1, 2, 3, 4, 5, 6, 7, 8};
int16_t lanes[8] = {-1, 0, 1, 2, 3, 4, 5, -32768};
Handle<Int16x8> value = factory->NewInt16x8(lanes);
CHECK(value->IsInt16x8());
......@@ -339,26 +325,12 @@ TEST(SimdObjects) {
#ifdef OBJECT_PRINT
std::ostringstream os;
value->Int16x8Print(os);
CHECK_EQ("1, 2, 3, 4, 5, 6, 7, 8", os.str());
#endif // OBJECT_PRINT
}
// Uint16x8
{
uint16_t lanes[8] = {1, 2, 3, 4, 5, 6, 7, 8};
Handle<Uint16x8> value = factory->NewUint16x8(lanes);
CHECK(value->IsUint16x8());
CheckSimdValue<Uint16x8, uint16_t, 8>(*value, lanes, 32767);
#ifdef OBJECT_PRINT
std::ostringstream os;
value->Uint16x8Print(os);
CHECK_EQ("1, 2, 3, 4, 5, 6, 7, 8", os.str());
CHECK_EQ("-1, 0, 1, 2, 3, 4, 5, -32768", os.str());
#endif // OBJECT_PRINT
}
// Bool16x8
{
bool lanes[8] = {true, false, true, false, true, false, true, false};
bool lanes[8] = {true, true, true, true, true, true, true, false};
Handle<Bool16x8> value = factory->NewBool16x8(lanes);
CHECK(value->IsBool16x8());
......@@ -367,12 +339,12 @@ TEST(SimdObjects) {
#ifdef OBJECT_PRINT
std::ostringstream os;
value->Bool16x8Print(os);
CHECK_EQ("true, false, true, false, true, false, true, false", os.str());
CHECK_EQ("true, true, true, true, true, true, true, false", os.str());
#endif // OBJECT_PRINT
}
// Int8x16
{
int8_t lanes[16] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
int8_t lanes[16] = {-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, -128};
Handle<Int8x16> value = factory->NewInt8x16(lanes);
CHECK(value->IsInt8x16());
......@@ -381,27 +353,14 @@ TEST(SimdObjects) {
#ifdef OBJECT_PRINT
std::ostringstream os;
value->Int8x16Print(os);
CHECK_EQ("1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16", os.str());
#endif // OBJECT_PRINT
}
// Uint8x16
{
uint8_t lanes[16] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
Handle<Uint8x16> value = factory->NewUint8x16(lanes);
CHECK(value->IsUint8x16());
CheckSimdValue<Uint8x16, uint8_t, 16>(*value, lanes, 127);
#ifdef OBJECT_PRINT
std::ostringstream os;
value->Uint8x16Print(os);
CHECK_EQ("1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16", os.str());
CHECK_EQ("-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, -128",
os.str());
#endif // OBJECT_PRINT
}
// Bool8x16
{
bool lanes[16] = {true, false, true, false, true, false, true, false,
true, false, true, false, true, false, true, false};
bool lanes[16] = {true, true, true, true, true, true, true, false,
true, true, true, true, true, true, true, false};
Handle<Bool8x16> value = factory->NewBool8x16(lanes);
CHECK(value->IsBool8x16());
......@@ -411,8 +370,8 @@ TEST(SimdObjects) {
std::ostringstream os;
value->Bool8x16Print(os);
CHECK_EQ(
"true, false, true, false, true, false, true, false, true, false, "
"true, false, true, false, true, false",
"true, true, true, true, true, true, true, false, true, true, true, "
"true, true, true, true, false",
os.str());
#endif // OBJECT_PRINT
}
......
......@@ -109,12 +109,9 @@ TEST(SimdTypes) {
FLOAT_TEST(Float32x4, 4)
INT_TEST(Int32x4, 4, int32_t)
INT_TEST(Uint32x4, 4, uint32_t)
BOOL_TEST(Bool32x4, 4)
INT_TEST(Int16x8, 8, int16_t)
INT_TEST(Uint16x8, 8, uint16_t)
BOOL_TEST(Bool16x8, 8)
INT_TEST(Int8x16, 16, int8_t)
INT_TEST(Uint8x16, 16, uint8_t)
BOOL_TEST(Bool8x16, 16)
}
......@@ -45,9 +45,9 @@ function isValidSimdString(string, value, type, lanes) {
}
var simdTypeNames = ['Float32x4', 'Int32x4', 'Uint32x4', 'Bool32x4',
'Int16x8', 'Uint16x8', 'Bool16x8',
'Int8x16', 'Uint8x16', 'Bool8x16'];
var simdTypeNames = ['Float32x4', 'Int32x4', 'Bool32x4',
'Int16x8', 'Bool16x8',
'Int8x16', 'Bool8x16'];
var nonSimdValues = [347, 1.275, NaN, "string", null, undefined, {},
function() {}];
......@@ -212,24 +212,6 @@ function TestCoercions(type, lanes) {
test(4294967296, 0);
test(4294967297, 1);
break;
case 'Uint32x4':
test(Infinity, 0);
test(-Infinity, 0);
test(NaN, 0);
test(0, 0);
test(-0, 0);
test(Number.MIN_VALUE, 0);
test(-Number.MIN_VALUE, 0);
test(0.1, 0);
test(-0.1, 0);
test(1, 1);
test(1.1, 1);
test(-1, 4294967295);
test(-1.6, 4294967295);
test(4294967295, 4294967295);
test(4294967296, 0);
test(4294967297, 1);
break;
case 'Int16x8':
test(Infinity, 0);
test(-Infinity, 0);
......@@ -251,24 +233,6 @@ function TestCoercions(type, lanes) {
test(65536, 0);
test(65537, 1);
break;
case 'Uint16x8':
test(Infinity, 0);
test(-Infinity, 0);
test(NaN, 0);
test(0, 0);
test(-0, 0);
test(Number.MIN_VALUE, 0);
test(-Number.MIN_VALUE, 0);
test(0.1, 0);
test(-0.1, 0);
test(1, 1);
test(1.1, 1);
test(-1, 65535);
test(-1.6, 65535);
test(65535, 65535);
test(65536, 0);
test(65537, 1);
break;
case 'Int8x16':
test(Infinity, 0);
test(-Infinity, 0);
......@@ -290,24 +254,6 @@ function TestCoercions(type, lanes) {
test(256, 0);
test(257, 1);
break;
case 'Uint8x16':
test(Infinity, 0);
test(-Infinity, 0);
test(NaN, 0);
test(0, 0);
test(-0, 0);
test(Number.MIN_VALUE, 0);
test(-Number.MIN_VALUE, 0);
test(0.1, 0);
test(-0.1, 0);
test(1, 1);
test(1.1, 1);
test(-1, 255);
test(-1.6, 255);
test(255, 255);
test(256, 0);
test(257, 1);
break;
case 'Bool32x4':
case 'Bool16x8':
case 'Bool8x16':
......@@ -384,11 +330,8 @@ function TestEquality(type, lanes) {
test(NaN, NaN);
break;
case 'Int32x4':
case 'Uint32x4':
case 'Int16x8':
case 'Uint16x8':
case 'Int8x16':
case 'Uint8x16':
test(1, 2);
test(1, 1);
test(1, -1);
......@@ -438,11 +381,8 @@ function TestSameValue(type, lanes) {
test(NaN, NaN);
break;
case 'Int32x4':
case 'Uint32x4':
case 'Int16x8':
case 'Uint16x8':
case 'Int8x16':
case 'Uint8x16':
test(1, 2);
test(1, 1);
test(1, -1);
......
......@@ -14,8 +14,8 @@ from testrunner.local import testsuite
from testrunner.local import utils
from testrunner.objects import testcase
SIMDJS_ARCHIVE_REVISION = "0fecaab13e57e9be50d87e3fa49b2729838bb75c"
SIMDJS_ARCHIVE_MD5 = "ce25acf841b76624607b39252122bb0e"
SIMDJS_ARCHIVE_REVISION = "99ef44bd4f22acd203c01e524131bc7f2a7eab68"
SIMDJS_ARCHIVE_MD5 = "1428773887924fa5a784bf0843615740"
SIMDJS_URL = ("https://github.com/tc39/ecmascript_simd/archive/%s.tar.gz")
SIMDJS_SUITE_PATH = ["data", "src"]
......@@ -44,7 +44,7 @@ class SimdJsTestSuite(testsuite.TestSuite):
def GetFlagsForTestCase(self, testcase, context):
return (testcase.flags + context.mode_flags +
[os.path.join(self.root, "harness-adapt.js"),
"--harmony --harmony-simd",
"--harmony",
os.path.join(self.testroot, testcase.path + ".js"),
os.path.join(self.root, "harness-finish.js")])
......
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