SIMD_ALL_TYPES(DECLARE_COMMON_FUNCTIONS)
-macro DECLARE_INT_FUNCTIONS(NAME, TYPE, LANES)
+macro DECLARE_SHIFT_FUNCTIONS(NAME, TYPE, LANES)
function NAMEShiftLeftByScalarJS(instance, shift) {
return %NAMEShiftLeftByScalar(instance, shift);
}
}
endmacro
-SIMD_INT_TYPES(DECLARE_INT_FUNCTIONS)
-
-macro DECLARE_UINT_FUNCTIONS(NAME, TYPE, LANES)
-function NAMEShiftLeftByScalarJS(instance, shift) {
- return %NAMEShiftLeftByScalar(instance, shift);
-}
-
-function NAMEShiftRightByScalarJS(instance, shift) {
- return %NAMEShiftRightByScalar(instance, shift);
-}
-
-function NAMEHorizontalSumJS(instance) {
- return %NAMEHorizontalSum(instance);
-}
-endmacro
-
-SIMD_UINT_TYPES(DECLARE_UINT_FUNCTIONS)
+SIMD_INT_TYPES(DECLARE_SHIFT_FUNCTIONS)
+SIMD_UINT_TYPES(DECLARE_SHIFT_FUNCTIONS)
macro SIMD_SMALL_INT_TYPES(FUNCTION)
FUNCTION(Int16x8)
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);
'not', Uint32x4NotJS,
'shiftLeftByScalar', Uint32x4ShiftLeftByScalarJS,
'shiftRightByScalar', Uint32x4ShiftRightByScalarJS,
- 'horizontalSum', Uint32x4HorizontalSumJS,
'lessThan', Uint32x4LessThanJS,
'lessThanOrEqual', Uint32x4LessThanOrEqualJS,
'greaterThan', Uint32x4GreaterThanJS,
'not', Uint16x8NotJS,
'shiftLeftByScalar', Uint16x8ShiftLeftByScalarJS,
'shiftRightByScalar', Uint16x8ShiftRightByScalarJS,
- 'horizontalSum', Uint16x8HorizontalSumJS,
- 'absoluteDifference', Uint16x8AbsoluteDifferenceJS,
- 'widenedAbsoluteDifference', Uint16x8WidenedAbsoluteDifferenceJS,
'lessThan', Uint16x8LessThanJS,
'lessThanOrEqual', Uint16x8LessThanOrEqualJS,
'greaterThan', Uint16x8GreaterThanJS,
'not', Uint8x16NotJS,
'shiftLeftByScalar', Uint8x16ShiftLeftByScalarJS,
'shiftRightByScalar', Uint8x16ShiftRightByScalarJS,
- 'horizontalSum', Uint8x16HorizontalSumJS,
- 'absoluteDifference', Uint8x16AbsoluteDifferenceJS,
- 'widenedAbsoluteDifference', Uint8x16WidenedAbsoluteDifferenceJS,
'lessThan', Uint8x16LessThanJS,
'lessThanOrEqual', Uint8x16LessThanOrEqualJS,
'greaterThan', Uint8x16GreaterThanJS,
}
-// 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 *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_ASR_FUNCTION)
SIMD_UINT_TYPES(SIMD_LSR_FUNCTION)
-SIMD_UINT_TYPES(SIMD_HORIZONTAL_SUM_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) \
F(Uint32x4Not, 1, 1) \
F(Uint32x4ShiftLeftByScalar, 2, 1) \
F(Uint32x4ShiftRightByScalar, 2, 1) \
- F(Uint32x4HorizontalSum, 1, 1) \
F(Uint32x4Equal, 2, 1) \
F(Uint32x4NotEqual, 2, 1) \
F(Uint32x4LessThan, 2, 1) \
F(Uint16x8Not, 1, 1) \
F(Uint16x8ShiftLeftByScalar, 2, 1) \
F(Uint16x8ShiftRightByScalar, 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(Uint8x16Not, 1, 1) \
F(Uint8x16ShiftLeftByScalar, 2, 1) \
F(Uint8x16ShiftRightByScalar, 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) \
from testrunner.local import utils
from testrunner.objects import testcase
-SIMDJS_ARCHIVE_REVISION = "a0cc399c46c160748eae77c3c656b5fa3c8f36cb"
-SIMDJS_ARCHIVE_MD5 = "574b9be4456c55183710f25165b99f81"
+SIMDJS_ARCHIVE_REVISION = "c8ef63c728283debc25891123eb00482fee4b8cd"
+SIMDJS_ARCHIVE_MD5 = "4c3120d1f5b8027b4a38b931119c89bd"
SIMDJS_URL = ("https://github.com/tc39/ecmascript_simd/archive/%s.tar.gz")
SIMDJS_SUITE_PATH = ["data", "src"]