42 #include "private/qsimd_p.h"
45 #include <QtCore/qdatastream.h>
167 return isInf() ? FP_INFINITE : isNaN() ? FP_NAN
168 : !(b16 & 0x7fff) ? FP_ZERO : isNormal() ? FP_NORMAL : FP_SUBNORMAL;
196 #if QT_COMPILER_SUPPORTS_HERE(F16C)
197 static inline bool hasFastF16()
201 return qCpuHasFeature(F16C);
209 for (;
i <
len - 7;
i += 8)
210 _mm_storeu_si128((__m128i *)(
out +
i), _mm256_cvtps_ph(_mm256_loadu_ps(
in +
i), 0));
212 _mm_storel_epi64((__m128i *)(
out +
i), _mm_cvtps_ph(_mm_loadu_ps(
in +
i), 0));
216 for (epilog_i = 0;
i <
len && epilog_i < 3; ++
i, ++epilog_i)
217 out[
i] = _mm_extract_epi16(_mm_cvtps_ph(_mm_set_ss(
in[
i]), 0), 0);
225 for (;
i <
len - 7;
i += 8)
226 _mm256_storeu_ps(
out +
i, _mm256_cvtph_ps(_mm_loadu_si128((
const __m128i *)(
in +
i))));
228 _mm_storeu_ps(
out +
i, _mm_cvtph_ps(_mm_loadl_epi64((
const __m128i *)(
in +
i))));
232 for (epilog_i = 0;
i <
len && epilog_i < 3; ++
i, ++epilog_i)
233 out[
i] = _mm_cvtss_f32(_mm_cvtph_ps(_mm_cvtsi32_si128(
in[
i])));
236 #elif defined(__ARM_FP16_FORMAT_IEEE) && defined(__ARM_NEON__) && (__ARM_FP & 2)
237 static inline bool hasFastF16()
244 __fp16 *out_f16 =
reinterpret_cast<__fp16 *
>(
out);
246 for (;
i <
len - 3;
i += 4)
247 vst1_f16(out_f16 +
i, vcvt_f16_f32(vld1q_f32(
in +
i)));
249 out_f16[
i] = __fp16(
in[
i]);
254 const __fp16 *in_f16 =
reinterpret_cast<const __fp16 *
>(
in);
256 for (;
i <
len - 3;
i += 4)
257 vst1q_f32(
out +
i, vcvt_f32_f16(vld1_f16(in_f16 +
i)));
259 out[
i] =
float(in_f16[
i]);
262 static inline bool hasFastF16()
267 static void qFloatToFloat16_fast(
quint16 *,
const float *,
qsizetype) noexcept
272 static void qFloatFromFloat16_fast(
float *,
const quint16 *,
qsizetype) noexcept
290 return qFloatToFloat16_fast(
reinterpret_cast<quint16 *
>(
out),
in,
len);
309 return qFloatFromFloat16_fast(
out,
reinterpret_cast<const quint16 *
>(
in),
len);
315 #ifndef QT_NO_DATASTREAM
small capitals from c petite p scientific i
[1]
The QDataStream class provides serialization of binary data to a QIODevice.
operator>>(QDataStream &ds, qfloat16 &f)
operator<<(QDataStream &ds, qfloat16 f)
Provides 16-bit floating point support.
Q_CORE_EXPORT void qFloatFromFloat16(float *out, const qfloat16 *in, qsizetype len) noexcept
Q_CORE_EXPORT void qFloatToFloat16(qfloat16 *out, const float *in, qsizetype len) noexcept
auto it unsigned count const
#define QT_FUNCTION_TARGET(x)
#define SIMD_EPILOGUE(i, length, max)
QTextStream out(stdout)
[7]