From 13673ced441f90fa62b41e69b5d5d7341d2e24f9 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 4 Dec 2013 17:14:07 -0800 Subject: Replace the qCpuHasFeature function with a macro We want to make sure that there's a constant propagation from the static variable that is filled in with the current code-generation options. With most compilers in debug mode, we'd carry dead code. With MSVC, even inlining is really bad even in release mode, and it doesn't perform constant propagation even with __forceinline. Change-Id: I7a95ff6622b864771243990bb5e205b2df0c33fc Reviewed-by: Marc Mutz --- src/corelib/tools/qsimd_p.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src/corelib/tools/qsimd_p.h') diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index 98eb473da0..b01c47d4ce 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -239,11 +239,7 @@ static inline uint qCpuFeatures() return uint(features); } -static inline uint qCpuHasFeature(CPUFeatures feature) -{ - return qCompilerCpuFeatures & feature || qCpuFeatures() & feature; -} - +#define qCpuHasFeature(feature) ((qCompilerCpuFeatures & (feature)) || (qCpuFeatures() & (feature))) #define ALIGNMENT_PROLOGUE_16BYTES(ptr, i, length) \ for (; i < static_cast(qMin(static_cast(length), ((4 - ((reinterpret_cast(ptr) >> 2) & 0x3)) & 0x3))); ++i) -- cgit v1.2.3