Ensure that qdrawhelper.cpp is compiled with vectorisation active
authorThiago Macieira <thiago.macieira@intel.com>
Thu, 29 Dec 2011 21:28:23 +0000 (19:28 -0200)
committerQt by Nokia <qt-info@nokia.com>
Wed, 28 Mar 2012 19:24:43 +0000 (21:24 +0200)
The GCC option -ftree-vectorize is enabled only at level -O3, so force
-O3 if this is an optimised build. Also, ensure that we're using SSE
for floating point math if we're in x86 (32-bit) builds.

No change is necessary for the Intel compiler, since it enables
vectorisation by default at any non-zero -O level.

These options are not possible with MSVC.

Change-Id: If1169a73cd8a3e8b34d9e21f281b78897b9aec3e
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
src/gui/painting/qdrawhelper.cpp

index 774678c..43c4781 100644 (file)
 **
 ****************************************************************************/
 
+#if defined(__OPTIMIZE__) && !defined(__INTEL_COMPILER) && defined(__GNUC__) \
+    && (__GNUC__ * 100 + __GNUC_MINOR__ >= 404)
+// GCC 4.4 supports #pragma GCC optimize and #pragma GCC target
+#  pragma GCC optimize "O3"
+#  if defined(__i386__) && defined(__SSE2__) && !defined(__SSE2_MATH__)
+#   pragma GCC target "fpmath=sse"
+#  endif
+#endif
+
 #include <qstylehints.h>
 #include <qguiapplication.h>
 #include <qatomic.h>