From: Alexander Alekhin Date: Mon, 18 Oct 2021 07:15:15 +0000 (+0000) Subject: core(SIMD): update int64 SSE constructor X-Git-Tag: accepted/tizen/unified/20230127.161057~1^2~6^2~291^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b5fcb06a7612e2f0a1f9c0ea2820a34ef0da4206;p=platform%2Fupstream%2Fopencv.git core(SIMD): update int64 SSE constructor --- diff --git a/modules/core/include/opencv2/core/hal/intrin_sse.hpp b/modules/core/include/opencv2/core/hal/intrin_sse.hpp index f4b43a2..2244717 100644 --- a/modules/core/include/opencv2/core/hal/intrin_sse.hpp +++ b/modules/core/include/opencv2/core/hal/intrin_sse.hpp @@ -244,7 +244,13 @@ struct v_uint64x2 explicit v_uint64x2(__m128i v) : val(v) {} v_uint64x2(uint64 v0, uint64 v1) { +#if defined(_MSC_VER) && _MSC_VER >= 1920/*MSVS 2019*/ && defined(_M_X64) + val = _mm_setr_epi64x((int64_t)v0, (int64_t)v1); +#elif defined(__GNUC__) + val = _mm_setr_epi64((__m64)v0, (__m64)v1); +#else val = _mm_setr_epi32((int)v0, (int)(v0 >> 32), (int)v1, (int)(v1 >> 32)); +#endif } uint64 get0() const @@ -272,7 +278,13 @@ struct v_int64x2 explicit v_int64x2(__m128i v) : val(v) {} v_int64x2(int64 v0, int64 v1) { +#if defined(_MSC_VER) && _MSC_VER >= 1920/*MSVS 2019*/ && defined(_M_X64) + val = _mm_setr_epi64x((int64_t)v0, (int64_t)v1); +#elif defined(__GNUC__) + val = _mm_setr_epi64((__m64)v0, (__m64)v1); +#else val = _mm_setr_epi32((int)v0, (int)(v0 >> 32), (int)v1, (int)(v1 >> 32)); +#endif } int64 get0() const diff --git a/modules/core/test/test_intrin_utils.hpp b/modules/core/test/test_intrin_utils.hpp index 5c22caa..3f196f1 100644 --- a/modules/core/test/test_intrin_utils.hpp +++ b/modules/core/test/test_intrin_utils.hpp @@ -373,6 +373,23 @@ template struct TheTest EXPECT_EQ((LaneType)12, vx_setall_res2_[i]); } +#if CV_SIMD_WIDTH == 16 + { + uint64 a = CV_BIG_INT(0x7fffffffffffffff); + uint64 b = (uint64)CV_BIG_INT(0xcfffffffffffffff); + v_uint64x2 uint64_vec(a, b); + EXPECT_EQ(a, uint64_vec.get0()); + EXPECT_EQ(b, v_extract_n<1>(uint64_vec)); + } + { + int64 a = CV_BIG_INT(0x7fffffffffffffff); + int64 b = CV_BIG_INT(-1); + v_int64x2 int64_vec(a, b); + EXPECT_EQ(a, int64_vec.get0()); + EXPECT_EQ(b, v_extract_n<1>(int64_vec)); + } +#endif + return *this; }