diff options
-rw-r--r-- | src/corelib/global/qlibraryinfo.cpp | 3 | ||||
-rw-r--r-- | src/corelib/tools/qsimd.cpp | 53 |
2 files changed, 56 insertions, 0 deletions
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 7ebee3d..b4f5d0f 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -525,6 +525,9 @@ void qt_core_boilerplate() qt_configure_libraries_path_str + 12, qt_configure_headers_path_str + 12); + extern void qDumpCPUFeatures(); + qDumpCPUFeatures(); + #ifdef QT_EVAL extern void qt_core_eval_init(uint); qt_core_eval_init(1); diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp index a5ec3c5..2472449 100644 --- a/src/corelib/tools/qsimd.cpp +++ b/src/corelib/tools/qsimd.cpp @@ -41,6 +41,7 @@ #include "qsimd_p.h" #include <QByteArray> +#include <stdio.h> #if defined(Q_OS_WINCE) #include <windows.h> @@ -404,4 +405,56 @@ uint qDetectCPUFeatures() return features; } +void qDumpCPUFeatures() +{ + /* + * Use kdesdk/scripts/generate_string_table.pl to update the table below. + * Here's the data: +mmx +mmxext +mmx3dnow +mmx3dnowext +sse +sse2 +cmov +iwmmxt +neon +sse3 +ssse3 +sse4.1 +sse4.2 +avx + */ + static const char features_string[] = + "mmx\0" + "mmxext\0" + "mmx3dnow\0" + "mmx3dnowext\0" + "sse\0" + "sse2\0" + "cmov\0" + "iwmmxt\0" + "neon\0" + "sse3\0" + "ssse3\0" + "sse4.1\0" + "sse4.2\0" + "avx\0" + "\0"; + + static const int features_indices[] = { + 0, 4, 11, 20, 32, 36, 41, 46, + 53, 58, 63, 69, 76, 83, -1 + }; + const int features_count = (sizeof features_indices - 1) / (sizeof features_indices[0]); + + uint features = qDetectCPUFeatures(); + printf("Processor features: "); + for (int i = 0; i < features_count; ++i) { + if (features & (1 << i)) + printf(" %s", features_string + features_indices[i]); + } + puts(""); +} + QT_END_NAMESPACE |