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

Function float_to_float16

Source/astcenc_vecmathlib_sse_4.h:967–980  ·  view source on GitHub ↗

* @brief Return a float16 value for a float vector, using round-to-nearest. */

Source from the content-addressed store, hash-verified

965 * @brief Return a float16 value for a float vector, using round-to-nearest.
966 */
967ASTCENC_SIMD_INLINE vint4 float_to_float16(vfloat4 a)
968{
969#if ASTCENC_F16C >= 1
970 __m128i packedf16 = _mm_cvtps_ph(a.m, 0);
971 __m128i f16 = _mm_cvtepu16_epi32(packedf16);
972 return vint4(f16);
973#else
974 return vint4(
975 float_to_sf16(a.lane<0>()),
976 float_to_sf16(a.lane<1>()),
977 float_to_sf16(a.lane<2>()),
978 float_to_sf16(a.lane<3>()));
979#endif
980}
981
982/**
983 * @brief Return a float16 value for a float scalar, using round-to-nearest.

Callers 4

compress_blockFunction · 0.70
store_image_blockFunction · 0.70
TESTFunction · 0.50

Calls 2

float_to_sf16Function · 0.85
vint4Class · 0.70

Tested by 1

TESTFunction · 0.40