Skip to content

Remove vint4 hadd_s() #527

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions Source/UnitTest/test_simd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1651,18 +1651,6 @@ TEST(vint4, hmax)
EXPECT_EQ(r2.lane<3>(), 5);
}

/** @brief Test vint4 hadd_s. */
TEST(vint4, hadd_s)
{
vint4 a1(1, 3, 5, 7);
int r1 = hadd_s(a1);
EXPECT_EQ(r1, 16);

vint4 a2(1, 2, -1, 5);
int r2 = hadd_s(a2);
EXPECT_EQ(r2, 7);
}

/** @brief Test vint4 hadd_rgb_s. */
TEST(vint4, hadd_rgb_s)
{
Expand Down
9 changes: 0 additions & 9 deletions Source/astcenc_vecmathlib_neon_4.h
Original file line number Diff line number Diff line change
Expand Up @@ -582,15 +582,6 @@ ASTCENC_SIMD_INLINE vint4 hmax(vint4 a)
return vint4(vmaxvq_s32(a.m));
}

/**
* @brief Return the horizontal sum of a vector.
*/
ASTCENC_SIMD_INLINE int hadd_s(vint4 a)
{
int32x2_t t = vadd_s32(vget_high_s32(a.m), vget_low_s32(a.m));
return vget_lane_s32(vpadd_s32(t, t), 0);
}

/**
* @brief Store a vector to a 16B aligned memory address.
*/
Expand Down
8 changes: 0 additions & 8 deletions Source/astcenc_vecmathlib_none_4.h
Original file line number Diff line number Diff line change
Expand Up @@ -646,14 +646,6 @@ ASTCENC_SIMD_INLINE vint4 hmax(vint4 a)
return vint4(std::max(b, c));
}

/**
* @brief Return the horizontal sum of vector lanes as a scalar.
*/
ASTCENC_SIMD_INLINE int hadd_s(vint4 a)
{
return a.m[0] + a.m[1] + a.m[2] + a.m[3];
}

/**
* @brief Store a vector to an aligned memory address.
*/
Expand Down
16 changes: 0 additions & 16 deletions Source/astcenc_vecmathlib_sse_4.h
Original file line number Diff line number Diff line change
Expand Up @@ -621,22 +621,6 @@ ASTCENC_SIMD_INLINE vint4 hmax(vint4 a)
return a;
}

/**
* @brief Return the horizontal sum of a vector as a scalar.
*/
ASTCENC_SIMD_INLINE int hadd_s(vint4 a)
{
// Add top and bottom halves, lane 1/0
__m128i fold = _mm_castps_si128(_mm_movehl_ps(_mm_castsi128_ps(a.m),
_mm_castsi128_ps(a.m)));
__m128i t = _mm_add_epi32(a.m, fold);

// Add top and bottom halves, lane 0 (_mm_hadd_ps exists but slow)
t = _mm_add_epi32(t, _mm_shuffle_epi32(t, 0x55));

return _mm_cvtsi128_si32(t);
}

/**
* @brief Store a vector to a 16B aligned memory address.
*/
Expand Down