summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2020-06-25 14:05:09 -0700
committerThiago Macieira <thiago.macieira@intel.com>2022-11-28 10:59:20 -0800
commit99c7f0419e66692260be56c0385badeacb3f6760 (patch)
treeae8d1b032bb36c72c102f99d64fda35a9fdedbbb /tests/auto/corelib
parent21950e3085bd45dbd4b55fb76e3d47319cbb11d7 (diff)
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 (<stdfloat> 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 <edward.welbourne@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r--tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp4
1 files changed, 2 insertions, 2 deletions
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]);