* @brief Return the horizontal sum of a vector as a scalar. */
| 859 | * @brief Return the horizontal sum of a vector as a scalar. |
| 860 | */ |
| 861 | ASTCENC_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. |
nothing calls this directly
no outgoing calls
no test coverage detected