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 <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Thiago Macieira 2022-07-04 09:01:47 -07:00
parent 1e4673e8b0
commit 3622fc81ea
2 changed files with 6 additions and 0 deletions

View File

@ -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)

View File

@ -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