Skip to content

Commit

Permalink
Fix compiling qfloat16_f16c.c with C89 compiler
Browse files Browse the repository at this point in the history
Needed by gcc 4.8

Change-Id: I2daa5728761599255cf3912d37e7b9dd60ccb60c
Reviewed-by: Eirik Aavitsland <[email protected]>
  • Loading branch information
Allan Sandfeld Jensen authored and liangqi committed Feb 14, 2018
1 parent 7bc1d6e commit e843e3b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/corelib/global/qfloat16_f16c.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,29 +57,31 @@ QT_FUNCTION_TARGET(F16C)
void qFloatToFloat16_fast(quint16 *out, const float *in, qsizetype len) Q_DECL_NOTHROW
{
qsizetype i = 0;
int epilog_i;
for (; i < len - 7; i += 8)
_mm_storeu_si128((__m128i *)(out + i), _mm256_cvtps_ph(_mm256_loadu_ps(in + i), 0));
if (i < len - 3) {
_mm_storel_epi64((__m128i *)(out + i), _mm_cvtps_ph(_mm_loadu_ps(in + i), 0));
i += 4;
}
// Inlining "qfloat16::qfloat16(float f)":
SIMD_EPILOGUE(i, len, 3)
for (epilog_i = 0; i < len && epilog_i < 3; ++i, ++epilog_i)
out[i] = _mm_extract_epi16(_mm_cvtps_ph(_mm_set_ss(in[i]), 0), 0);
}

QT_FUNCTION_TARGET(F16C)
void qFloatFromFloat16_fast(float *out, const quint16 *in, qsizetype len) Q_DECL_NOTHROW
{
qsizetype i = 0;
int epilog_i;
for (; i < len - 7; i += 8)
_mm256_storeu_ps(out + i, _mm256_cvtph_ps(_mm_loadu_si128((const __m128i *)(in + i))));
if (i < len - 3) {
_mm_storeu_ps(out + i, _mm_cvtph_ps(_mm_loadl_epi64((const __m128i *)(in + i))));
i += 4;
}
// Inlining "qfloat16::operator float()":
SIMD_EPILOGUE(i, len, 3)
for (epilog_i = 0; i < len && epilog_i < 3; ++i, ++epilog_i)
out[i] = _mm_cvtss_f32(_mm_cvtph_ps(_mm_cvtsi32_si128(in[i])));
}

Expand Down

0 comments on commit e843e3b

Please sign in to comment.