diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2017-11-09 15:14:31 -0800 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2017-12-15 07:39:54 +0000 |
commit | 259acdcb8a38b8989a137942d20ed2685a4c940a (patch) | |
tree | e529816eef15763ddc7c4df7e26b5e6820fc05a9 /src/corelib/global/qfloat16.cpp | |
parent | 0b4b864d83b18c18f4e743754ccbc1134713f352 (diff) |
qfloat16_f16c.c: inline in qfloat16.cpp if F16C is permitted in there
This is going to be the most common scenario for GCC: all recent
versions allow compiling F16C code in the same source, thus generating
better code.
MSVC is excluded unless AVX is already turned on by the user in the
mkspec file, because it fails to use the VEX-prefixed instructions for
everything else, printing a warning that it knows it should have done
so.
ICC is excluded because it's known to generate invalid code when using
the F16C intrinsics unless F16C is turned explicitly on.
Clang is excluded because it runs into an internal error compiling this
code unless F16C is turned explicitly on.
Change-Id: I57a1bd6e0c194530b732fffd14f58de6a46f0de1
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/corelib/global/qfloat16.cpp')
-rw-r--r-- | src/corelib/global/qfloat16.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/corelib/global/qfloat16.cpp b/src/corelib/global/qfloat16.cpp index 4c9b831469..129ab4ded2 100644 --- a/src/corelib/global/qfloat16.cpp +++ b/src/corelib/global/qfloat16.cpp @@ -123,8 +123,16 @@ static inline bool hasFastF16() } extern "C" { -extern void qFloatToFloat16_fast(quint16 *out, const float *in, qssize_t len) Q_DECL_NOTHROW; -extern void qFloatFromFloat16_fast(float *out, const quint16 *in, qssize_t len) Q_DECL_NOTHROW; +#ifdef QFLOAT16_INCLUDE_FAST +# define f16cextern static +#else +# define f16cextern extern +#endif + +f16cextern void qFloatToFloat16_fast(quint16 *out, const float *in, qssize_t len) Q_DECL_NOTHROW; +f16cextern void qFloatFromFloat16_fast(float *out, const quint16 *in, qssize_t len) Q_DECL_NOTHROW; + +#undef f16cextern } #elif defined(__ARM_FP16_FORMAT_IEEE) && defined(__ARM_NEON__) @@ -199,3 +207,7 @@ Q_CORE_EXPORT void qFloatFromFloat16(float *out, const qfloat16 *in, qssize_t le } QT_END_NAMESPACE + +#ifdef QFLOAT16_INCLUDE_FAST +# include "qfloat16_f16c.c" +#endif |