MCPcopy Create free account
hub / github.com/ARM-software/astc-encoder / hadd_s

Function hadd_s

Source/astcenc_vecmathlib_sse_4.h:861–870  ·  view source on GitHub ↗

* @brief Return the horizontal sum of a vector as a scalar. */

Source from the content-addressed store, hash-verified

859 * @brief Return the horizontal sum of a vector as a scalar.
860 */
861ASTCENC_SIMD_INLINE float hadd_s(vfloat4 a)
862{
863 // Add top and bottom halves, lane 1/0
864 __m128 t = _mm_add_ps(a.m, _mm_movehl_ps(a.m, a.m));
865
866 // Add top and bottom halves, lane 0 (_mm_hadd_ps exists but slow)
867 t = _mm_add_ss(t, _mm_shuffle_ps(t, t, 0x55));
868
869 return _mm_cvtss_f32(t);
870}
871
872/**
873 * @brief Return the sqrt of the lanes in the vector.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected