From 99c7f0419e66692260be56c0385badeacb3f6760 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 25 Jun 2020 14:05:09 -0700 Subject: qfloat16: add support for native _Float16 (C2x extended floating point) The C++ equivalent is std::float16_t, defined in P1467[1], and is coming with GCC 13 both in native mode (for x86, using AVX512FP16) and in emulated mode. The C and C++ types will be the same type ( simply typedefs). qfloat16 will need to remain a wrapper with an integer member to keep ABI with previous Qt versions. Because it is a trivially-copyable small type, it gets currently passed in registers; the presence of the integer member means it gets passed in general-purpose registers, while a single _Float16 member would be passed in a floating-point register. See: https://gcc.godbolt.org/z/8fEendjff [1] https://wg21.link/p1467 Change-Id: I8a5b6425b64a4e319b94fffd161be56397cb48e6 Reviewed-by: Edward Welbourne Reviewed-by: Allan Sandfeld Jensen --- tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp b/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp index e61ceff1c0..ffd44b1ff8 100644 --- a/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp +++ b/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp @@ -301,7 +301,7 @@ void tst_qfloat16::promotionTests() QCOMPARE(sizeof(double),sizeof(qfloat16(1.f)*1)); QCOMPARE(sizeof(double),sizeof(qfloat16(1.f)/1)); - QCOMPARE(QString::number(1.f),QString::number(qfloat16(1.f))); + QCOMPARE(QString::number(1.f),QString::number(double(qfloat16(1.f)))); } void tst_qfloat16::arithOps_data() @@ -624,7 +624,7 @@ void tst_qfloat16::mantissaOverflow() float f; memcpy(&f, &in, 4); - qfloat16 f16 = f; + qfloat16 f16 = qfloat16(f); qfloat16 f16s[1]; qFloatToFloat16(f16s, &f, 1); QCOMPARE(f16, f16s[0]); -- cgit v1.2.3