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)
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)
macro SIMD_ALL_TYPES(FUNCTION)
SIMD_FLOAT_TYPES(FUNCTION)
SIMD_INT_TYPES(FUNCTION)
+SIMD_UINT_TYPES(FUNCTION)
SIMD_BOOL_TYPES(FUNCTION)
endmacro
function NAMEExtractLaneJS(instance, lane) {
return %NAMEExtractLane(instance, lane);
}
+endmacro
-function NAMEEqualJS(a, b) {
- return %NAMEEqual(a, b);
+SIMD_ALL_TYPES(DECLARE_COMMON_FUNCTIONS)
+
+macro DECLARE_INT_FUNCTIONS(NAME, TYPE, LANES)
+function NAMEShiftLeftByScalarJS(instance, shift) {
+ return %NAMEShiftLeftByScalar(instance, shift);
}
-function NAMENotEqualJS(a, b) {
- return %NAMENotEqual(a, b);
+function NAMEShiftRightArithmeticByScalarJS(instance, shift) {
+ return %NAMEShiftRightArithmeticByScalar(instance, shift);
}
endmacro
-SIMD_ALL_TYPES(DECLARE_COMMON_FUNCTIONS)
+SIMD_INT_TYPES(DECLARE_INT_FUNCTIONS)
-macro DECLARE_INT_FUNCTIONS(NAME, TYPE, LANES)
+macro DECLARE_UINT_FUNCTIONS(NAME, TYPE, LANES)
function NAMEShiftLeftByScalarJS(instance, shift) {
return %NAMEShiftLeftByScalar(instance, shift);
}
return %NAMEShiftRightLogicalByScalar(instance, shift);
}
-function NAMEShiftRightArithmeticByScalarJS(instance, shift) {
- return %NAMEShiftRightArithmeticByScalar(instance, shift);
+function NAMEHorizontalSumJS(instance) {
+ return %NAMEHorizontalSum(instance);
}
endmacro
-SIMD_INT_TYPES(DECLARE_INT_FUNCTIONS)
+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);
+}
+endmacro
+
+SIMD_FLOAT_TYPES(DECLARE_SIGNED_FUNCTIONS)
+SIMD_INT_TYPES(DECLARE_SIGNED_FUNCTIONS)
macro DECLARE_BOOL_FUNCTIONS(NAME, TYPE, LANES)
function NAMEReplaceLaneJS(instance, lane, value) {
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)
return %NAMESelect(selector, a, b);
}
-function NAMENegJS(a) {
- return %NAMENeg(a);
-}
-
function NAMEAddJS(a, b) {
return %NAMEAdd(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);
}
macro SIMD_LOGICAL_TYPES(FUNCTION)
SIMD_INT_TYPES(FUNCTION)
+SIMD_UINT_TYPES(FUNCTION)
SIMD_BOOL_TYPES(FUNCTION)
endmacro
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)
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)
//-------------------------------------------------------------------
-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));
-}
-
+macro SIMD_X4_TYPES(FUNCTION)
+FUNCTION(Float32x4)
+FUNCTION(Int32x4)
+FUNCTION(Uint32x4)
+FUNCTION(Bool32x4)
+endmacro
-function Float32x4Splat(s) {
- return %CreateFloat32x4(s, s, s, s);
+macro DECLARE_X4_FUNCTIONS(NAME)
+function NAMESplat(s) {
+ return %CreateNAME(s, s, s, s);
}
-
-function Float32x4AbsJS(a) {
- return %Float32x4Abs(a);
+function NAMESwizzleJS(a, c0, c1, c2, c3) {
+ return %NAMESwizzle(a, c0, c1, c2, c3);
}
-
-function Float32x4SqrtJS(a) {
- return %Float32x4Sqrt(a);
+function NAMEShuffleJS(a, b, c0, c1, c2, c3) {
+ return %NAMEShuffle(a, b, c0, c1, c2, c3);
}
+endmacro
+SIMD_X4_TYPES(DECLARE_X4_FUNCTIONS)
-function Float32x4RecipApproxJS(a) {
- return %Float32x4RecipApprox(a);
-}
-
+macro SIMD_X8_TYPES(FUNCTION)
+FUNCTION(Int16x8)
+FUNCTION(Uint16x8)
+FUNCTION(Bool16x8)
+endmacro
-function Float32x4RecipSqrtApproxJS(a) {
- return %Float32x4RecipSqrtApprox(a);
+macro DECLARE_X8_FUNCTIONS(NAME)
+function NAMESplat(s) {
+ return %CreateNAME(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) {
+ return %NAMESwizzle(a, c0, c1, c2, c3, c4, c5, c6, c7);
}
-
-function Float32x4MinNumJS(a, b) {
- return %Float32x4MinNum(a, b);
+function NAMEShuffleJS(a, b, c0, c1, c2, c3, c4, c5, c6, c7) {
+ return %NAMEShuffle(a, b, c0, c1, c2, c3, c4, c5, c6, c7);
}
+endmacro
+SIMD_X8_TYPES(DECLARE_X8_FUNCTIONS)
-function Float32x4MaxNumJS(a, b) {
- return %Float32x4MaxNum(a, b);
+macro SIMD_X16_TYPES(FUNCTION)
+FUNCTION(Int8x16)
+FUNCTION(Uint8x16)
+FUNCTION(Bool8x16)
+endmacro
+
+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 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 Float32x4SwizzleJS(a, c0, c1, c2, c3) {
- return %Float32x4Swizzle(a, c0, c1, c2, c3);
+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);
}
+endmacro
+SIMD_X16_TYPES(DECLARE_X16_FUNCTIONS)
-function Float32x4ShuffleJS(a, b, c0, c1, c2, c3) {
- return %Float32x4Shuffle(a, b, 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 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);
+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 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),
}
-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);
+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 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");
}
-function Int8x16Splat(s) {
- return %CreateInt8x16(s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s);
+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 Int8x16SwizzleJS(a, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11,
- c12, c13, c14, c15) {
- return %Int8x16Swizzle(a, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11,
- c12, c13, c14, c15);
+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 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 Float32x4AbsJS(a) {
+ return %Float32x4Abs(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 Float32x4SqrtJS(a) {
+ return %Float32x4Sqrt(a);
}
-function Bool8x16Splat(s) {
- return %CreateBool8x16(s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s);
+function Float32x4RecipApproxJS(a) {
+ return %Float32x4RecipApprox(a);
+}
+
+
+function Float32x4RecipSqrtApproxJS(a) {
+ return %Float32x4RecipSqrtApprox(a);
+}
+
+
+function Float32x4DivJS(a, b) {
+ return %Float32x4Div(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 Float32x4MinNumJS(a, b) {
+ return %Float32x4MinNum(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);
+function Float32x4MaxNumJS(a, b) {
+ return %Float32x4MaxNum(a, b);
}
'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, [
'xor', Int32x4XorJS,
'not', Int32x4NotJS,
'shiftLeftByScalar', Int32x4ShiftLeftByScalarJS,
- 'shiftRightLogicalByScalar', Int32x4ShiftRightLogicalByScalarJS,
'shiftRightArithmeticByScalar', Int32x4ShiftRightArithmeticByScalarJS,
'lessThan', Int32x4LessThanJS,
'lessThanOrEqual', Int32x4LessThanOrEqualJS,
'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, [
'not', Bool32x4NotJS,
'anyTrue', Bool32x4AnyTrueJS,
'allTrue', Bool32x4AllTrueJS,
- 'equal', Bool32x4EqualJS,
- 'notEqual', Bool32x4NotEqualJS,
'swizzle', Bool32x4SwizzleJS,
'shuffle', Bool32x4ShuffleJS,
]);
'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,
'xor', Int16x8XorJS,
'not', Int16x8NotJS,
'shiftLeftByScalar', Int16x8ShiftLeftByScalarJS,
- 'shiftRightLogicalByScalar', Int16x8ShiftRightLogicalByScalarJS,
'shiftRightArithmeticByScalar', Int16x8ShiftRightArithmeticByScalarJS,
'lessThan', Int16x8LessThanJS,
'lessThanOrEqual', Int16x8LessThanOrEqualJS,
'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, [
'not', Bool16x8NotJS,
'anyTrue', Bool16x8AnyTrueJS,
'allTrue', Bool16x8AllTrueJS,
- 'equal', Bool16x8EqualJS,
- 'notEqual', Bool16x8NotEqualJS,
'swizzle', Bool16x8SwizzleJS,
'shuffle', Bool16x8ShuffleJS,
]);
'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,
'xor', Int8x16XorJS,
'not', Int8x16NotJS,
'shiftLeftByScalar', Int8x16ShiftLeftByScalarJS,
- 'shiftRightLogicalByScalar', Int8x16ShiftRightLogicalByScalarJS,
'shiftRightArithmeticByScalar', Int8x16ShiftRightArithmeticByScalarJS,
'lessThan', Int8x16LessThanJS,
'lessThanOrEqual', Int8x16LessThanOrEqualJS,
'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, [
'not', Bool8x16NotJS,
'anyTrue', Bool8x16AnyTrueJS,
'allTrue', Bool8x16AllTrueJS,
- 'equal', Bool8x16EqualJS,
- 'notEqual', Bool8x16NotEqualJS,
'swizzle', Bool8x16SwizzleJS,
'shuffle', Bool8x16ShuffleJS,
]);
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;
});
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) \
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") \
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) \
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;
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) {
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 'int16x8': return %_CallFunction(obj, Int16x8ToString);
- case 'bool16x8': return %_CallFunction(obj, Bool16x8ToString);
+ case 'int8x16': return %_CallFunction(obj, Int8x16ToString);
+ case 'uint8x16': return %_CallFunction(obj, Uint8x16ToString);
+ case 'bool8x16': return %_CallFunction(obj, Bool8x16ToString);
}
}
if (IS_OBJECT(obj)
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
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)
} \
}
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
// - Simd128Value
// - Float32x4
// - Int32x4
+// - Uint32x4
// - Bool32x4
// - Int16x8
+// - Uint16x8
// - Bool16x8
// - Int8x16
+// - Uint8x16
// - Bool8x16
// - Cell
// - PropertyCell
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) \
#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) \
return true;
}
-} // namespace
+
+template <>
+bool CanCast<float>(uint32_t from) {
+ return true;
+}
+
template <typename T>
static T ConvertNumber(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; }
}
+// 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) {
return Max(a, b);
}
+} // namespace
//-------------------------------------------------------------------
#define GET_BOOLEAN_ARG(lane_type, name, index) \
name = args[index]->BooleanValue();
-#define SIMD_ALL_TYPES(FUNCTION) \
- FUNCTION(Float32x4, float, 4, NewNumber, GET_NUMERIC_ARG) \
- FUNCTION(Int32x4, int32_t, 4, NewNumber, GET_NUMERIC_ARG) \
- FUNCTION(Bool32x4, bool, 4, ToBoolean, GET_BOOLEAN_ARG) \
- FUNCTION(Int16x8, int16_t, 8, NewNumber, GET_NUMERIC_ARG) \
- FUNCTION(Bool16x8, bool, 8, ToBoolean, GET_BOOLEAN_ARG) \
- FUNCTION(Int8x16, int8_t, 16, NewNumber, GET_NUMERIC_ARG) \
+#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) \
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; \
if (shift < lane_bits) { \
for (int i = 0; i < kLaneCount; i++) { \
lanes[i] = static_cast<lane_type>( \
- bit_cast<u##lane_type>(a->get_lane(i)) >> shift); \
+ bit_cast<lane_type>(a->get_lane(i)) >> shift); \
} \
} \
Handle<type> result = isolate->factory()->New##type(lanes); \
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_INT_TYPES(SIMD_LSR_FUNCTION)
+SIMD_UINT_TYPES(SIMD_LSL_FUNCTION)
SIMD_INT_TYPES(SIMD_ASR_FUNCTION)
+SIMD_UINT_TYPES(SIMD_LSR_FUNCTION)
+SIMD_UINT_TYPES(SIMD_HORIZONTAL_SUM_FUNCTION)
//-------------------------------------------------------------------
#define SIMD_SMALL_INT_TYPES(FUNCTION) \
FUNCTION(Int16x8, int16_t, 8) \
- FUNCTION(Int8x16, int8_t, 16)
+ FUNCTION(Uint16x8, uint16_t, 8) \
+ FUNCTION(Int8x16, int8_t, 16) \
+ FUNCTION(Uint8x16, uint8_t, 16)
#define SIMD_ADD_SATURATE_FUNCTION(type, lane_type, lane_count) \
RUNTIME_FUNCTION(Runtime_##type##AddSaturate) { \
//-------------------------------------------------------------------
+// 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(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; \
- }
+ FUNCTION(Uint16x8, uint16_t, 8) \
+ FUNCTION(Int8x16, int8_t, 16) \
+ FUNCTION(Uint8x16, uint8_t, 16)
#define BINARY_ADD(a, b) (a) + (b)
#define SIMD_ADD_FUNCTION(type, lane_type, lane_count) \
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)
#define SIMD_RELATIONAL_TYPES(FUNCTION) \
FUNCTION(Float32x4, Bool32x4, 4) \
FUNCTION(Int32x4, Bool32x4, 4) \
+ FUNCTION(Uint32x4, Bool32x4, 4) \
FUNCTION(Int16x8, Bool16x8, 8) \
- FUNCTION(Int8x16, Bool8x16, 16)
+ FUNCTION(Uint16x8, Bool16x8, 8) \
+ FUNCTION(Int8x16, Bool8x16, 16) \
+ FUNCTION(Uint8x16, Bool8x16, 16)
#define SIMD_EQUALITY_TYPES(FUNCTION) \
SIMD_RELATIONAL_TYPES(FUNCTION) \
// Logical functions.
-#define SIMD_LOGICAL_TYPES(FUNCTION) \
- FUNCTION(Int32x4, int32_t, 4, _INT) \
- FUNCTION(Int16x8, int16_t, 8, _INT) \
- FUNCTION(Int8x16, int8_t, 16, _INT) \
- FUNCTION(Bool32x4, bool, 4, _BOOL) \
- FUNCTION(Bool16x8, bool, 8, _BOOL) \
+#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)
#define BINARY_AND_INT(a, b) (a) & (b)
// Select functions.
-#define SIMD_SELECT_TYPES(FUNCTION) \
- FUNCTION(Float32x4, float, Bool32x4, 4) \
- FUNCTION(Int32x4, int32_t, Bool32x4, 4) \
- FUNCTION(Int16x8, int16_t, Bool16x8, 8) \
- FUNCTION(Int8x16, int8_t, Bool8x16, 16)
+#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)
#define SIMD_SELECT_FUNCTION(type, lane_type, bool_type, lane_count) \
RUNTIME_FUNCTION(Runtime_##type##Select) { \
//-------------------------------------------------------------------
+// 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(Int32x4, int32_t, 4, Float32x4, float)
+#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)
#define SIMD_FROM_FUNCTION(type, lane_type, lane_count, from_type, from_ctype) \
RUNTIME_FUNCTION(Runtime_##type##From##from_type) { \
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)); \
lanes[i] = static_cast<lane_type>(a_value); \
} \
SIMD_FROM_TYPES(SIMD_FROM_FUNCTION)
-#define SIMD_FROM_BITS_TYPES(FUNCTION) \
- FUNCTION(Float32x4, float, 4, Int32x4) \
- FUNCTION(Float32x4, float, 4, Int16x8) \
- FUNCTION(Float32x4, float, 4, Int8x16) \
- FUNCTION(Int32x4, int32_t, 4, Float32x4) \
- FUNCTION(Int32x4, int32_t, 4, Int16x8) \
- FUNCTION(Int32x4, int32_t, 4, Int8x16) \
- FUNCTION(Int16x8, int16_t, 8, Float32x4) \
- FUNCTION(Int16x8, int16_t, 8, Int32x4) \
- FUNCTION(Int16x8, int16_t, 8, Int8x16) \
- FUNCTION(Int8x16, int8_t, 16, Float32x4) \
- FUNCTION(Int8x16, int8_t, 16, Int32x4) \
- FUNCTION(Int8x16, int8_t, 16, Int16x8)
+#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)
#define SIMD_FROM_BITS_FUNCTION(type, lane_type, lane_count, from_type) \
RUNTIME_FUNCTION(Runtime_##type##From##from_type##Bits) { \
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
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) \
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) \
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) \
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) \
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) \
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) \
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) \
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)
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");
}
}
// Int32x4
{
- int32_t lanes[4] = {-1, 0, 1, 2};
+ int32_t lanes[4] = {1, 2, 3, 4};
Handle<Int32x4> value = factory->NewInt32x4(lanes);
CHECK(value->IsInt32x4());
#ifdef OBJECT_PRINT
std::ostringstream os;
value->Int32x4Print(os);
- CHECK_EQ("-1, 0, 1, 2", os.str());
+ 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());
#endif // OBJECT_PRINT
}
// Bool32x4
{
- bool lanes[4] = {true, true, true, false};
+ bool lanes[4] = {true, false, true, false};
Handle<Bool32x4> value = factory->NewBool32x4(lanes);
CHECK(value->IsBool32x4());
#ifdef OBJECT_PRINT
std::ostringstream os;
value->Bool32x4Print(os);
- CHECK_EQ("true, true, true, false", os.str());
+ CHECK_EQ("true, false, true, false", os.str());
#endif // OBJECT_PRINT
}
// Int16x8
{
- int16_t lanes[8] = {-1, 0, 1, 2, 3, 4, 5, -32768};
+ int16_t lanes[8] = {1, 2, 3, 4, 5, 6, 7, 8};
Handle<Int16x8> value = factory->NewInt16x8(lanes);
CHECK(value->IsInt16x8());
#ifdef OBJECT_PRINT
std::ostringstream os;
value->Int16x8Print(os);
- CHECK_EQ("-1, 0, 1, 2, 3, 4, 5, -32768", os.str());
+ 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());
#endif // OBJECT_PRINT
}
// Bool16x8
{
- bool lanes[8] = {true, true, true, true, true, true, true, false};
+ bool lanes[8] = {true, false, true, false, true, false, true, false};
Handle<Bool16x8> value = factory->NewBool16x8(lanes);
CHECK(value->IsBool16x8());
#ifdef OBJECT_PRINT
std::ostringstream os;
value->Bool16x8Print(os);
- CHECK_EQ("true, true, true, true, true, true, true, false", os.str());
+ CHECK_EQ("true, false, true, false, true, false, true, false", os.str());
#endif // OBJECT_PRINT
}
// Int8x16
{
- int8_t lanes[16] = {-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, -128};
+ int8_t lanes[16] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
Handle<Int8x16> value = factory->NewInt8x16(lanes);
CHECK(value->IsInt8x16());
#ifdef OBJECT_PRINT
std::ostringstream os;
value->Int8x16Print(os);
- CHECK_EQ("-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, -128",
- os.str());
+ 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());
#endif // OBJECT_PRINT
}
// Bool8x16
{
- bool lanes[16] = {true, true, true, true, true, true, true, false,
- true, true, true, true, true, true, true, false};
+ bool lanes[16] = {true, false, true, false, true, false, true, false,
+ true, false, true, false, true, false, true, false};
Handle<Bool8x16> value = factory->NewBool8x16(lanes);
CHECK(value->IsBool8x16());
std::ostringstream os;
value->Bool8x16Print(os);
CHECK_EQ(
- "true, true, true, true, true, true, true, false, true, true, true, "
- "true, true, true, true, false",
+ "true, false, true, false, true, false, true, false, true, false, "
+ "true, false, true, false, true, false",
os.str());
#endif // OBJECT_PRINT
}
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)
}
}
-var simdTypeNames = ['Float32x4', 'Int32x4', 'Bool32x4',
- 'Int16x8', 'Bool16x8',
- 'Int8x16', 'Bool8x16'];
+var simdTypeNames = ['Float32x4', 'Int32x4', 'Uint32x4', 'Bool32x4',
+ 'Int16x8', 'Uint16x8', 'Bool16x8',
+ 'Int8x16', 'Uint8x16', 'Bool8x16'];
var nonSimdValues = [347, 1.275, NaN, "string", null, undefined, {},
function() {}];
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);
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);
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':
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);
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);
from testrunner.local import utils
from testrunner.objects import testcase
-SIMDJS_ARCHIVE_REVISION = "99ef44bd4f22acd203c01e524131bc7f2a7eab68"
-SIMDJS_ARCHIVE_MD5 = "1428773887924fa5a784bf0843615740"
+SIMDJS_ARCHIVE_REVISION = "0fecaab13e57e9be50d87e3fa49b2729838bb75c"
+SIMDJS_ARCHIVE_MD5 = "ce25acf841b76624607b39252122bb0e"
SIMDJS_URL = ("https://github.com/tc39/ecmascript_simd/archive/%s.tar.gz")
SIMDJS_SUITE_PATH = ["data", "src"]