Skip to content

Commit

Permalink
Remove vint4 hadd_s() (#527)
Browse files Browse the repository at this point in the history
  • Loading branch information
solidpixel authored Nov 16, 2024
1 parent d8cda55 commit 6dc719e
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 45 deletions.
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

0 comments on commit 6dc719e

Please sign in to comment.