From 3622fc81ea29e1b20c6cd71269d383a8ffe90d68 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 4 Jul 2022 09:01:47 -0700 Subject: [PATCH] x86/RDSEED: Work around QNX compiler missing the rdseed intrinsic Since it's no big deal, we can disable this. Making it use rdseed via inline assembly or detect when the compiler is fixed is Someone Else's Problem. Fixes: QTBUG-104697 Change-Id: I89c4eb48af38408daa7cfffd16feabb5408e2fbf Reviewed-by: Fabian Kosmale Reviewed-by: Qt CI Bot --- config.tests/x86intrin/main.cpp | 2 ++ src/corelib/global/qsimd_p.h | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/config.tests/x86intrin/main.cpp b/config.tests/x86intrin/main.cpp index 4306a4721c9..297586fb4e7 100644 --- a/config.tests/x86intrin/main.cpp +++ b/config.tests/x86intrin/main.cpp @@ -12,7 +12,9 @@ int test(int argc, char **argv) { unsigned randomvalue; _rdrand32_step(&randomvalue); // RDRND (IVB) +#ifndef __QNXNTO__ // buggy compiler is missing this intrinsic, but we allow it _rdseed32_step(&randomvalue); // RDSEED (BDW) +#endif unsigned mask = _blsmsk_u32(argc); // BMI (HSW) int clz = _lzcnt_u32(mask); // LZCNT (HSW) int ctz = _tzcnt_u32(mask); // BMI (HSW) diff --git a/src/corelib/global/qsimd_p.h b/src/corelib/global/qsimd_p.h index af557bc976d..ad78c3934fb 100644 --- a/src/corelib/global/qsimd_p.h +++ b/src/corelib/global/qsimd_p.h @@ -173,6 +173,10 @@ QT_WARNING_DISABLE_INTEL(103) #ifdef Q_PROCESSOR_X86 /* -- x86 intrinsic support -- */ +# if defined(QT_COMPILER_SUPPORTS_RDSEED) && defined(Q_OS_QNX) +// The compiler for QNX is missing the intrinsic +# undef QT_COMPILER_SUPPORTS_RDSEED +# endif # if defined(Q_CC_MSVC) && (defined(_M_X64) || _M_IX86_FP >= 2) // MSVC doesn't define __SSE2__, so do it ourselves # define __SSE__ 1