summaryrefslogtreecommitdiffstats
path: root/mkspecs/features/simd.prf
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2018-05-23 00:54:19 -0300
committerThiago Macieira <thiago.macieira@intel.com>2018-07-09 00:18:24 +0000
commitc3a4ec5d0bbd5f2710f4fd1d3bd4a2d7f0f507ad (patch)
treef18c0e54743eb213df0e5374bb5fdf4281aa5c4e /mkspecs/features/simd.prf
parent746f15d0c213fef0e46207682815bd839a36ecc6 (diff)
SIMD: Add a haswell sub-architecture selection to our support
As the comment says, Haswell is a nice divider and is a good optimization target. I'm using -march=core-avx2 instead of -march=haswell because the latter form was only added to GCC 4.9 but we still support 4.7 and that has support for AVX2. This commit changes the AVX2-optimized code in QtGui to Haswell- optimized instead. That means, for example, that qdrawhelper_avx2.cpp can now use the FMA instructions. Change-Id: If025d476890745368955fffd153129c1716ba006 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'mkspecs/features/simd.prf')
-rw-r--r--mkspecs/features/simd.prf24
1 files changed, 23 insertions, 1 deletions
diff --git a/mkspecs/features/simd.prf b/mkspecs/features/simd.prf
index 65ba4b0d08..a0b40fcf11 100644
--- a/mkspecs/features/simd.prf
+++ b/mkspecs/features/simd.prf
@@ -141,6 +141,28 @@ addSimdCompiler(neon)
addSimdCompiler(mips_dsp)
addSimdCompiler(mips_dspr2)
+# Haswell sub-architecture
+defineTest(addSimdArch) {
+ name = arch_$$1
+ dependencies = $$2
+ upname = $$upper($$name)
+
+ cpu_features_missing =
+ for(part, dependencies) {
+ !contains(QT_CPU_FEATURES, $$part): cpu_features_missing = 1
+ }
+
+ CONFIG += $$name
+ isEmpty(cpu_features_missing): QT_CPU_FEATURES += $$name
+
+ export(QT_CPU_FEATURES)
+ export(CONFIG)
+ addSimdCompiler($$name)
+}
+
+isEmpty(QMAKE_CFLAGS_ARCH_HASWELL): QMAKE_CFLAGS_ARCH_HASWELL = $$QMAKE_CFLAGS_AVX2
+avx2: addSimdArch(haswell, avx2 bmi bmi2 f16c fma lzcnt popcnt)
+
# Follow the Intel compiler's lead and define profiles of AVX512 instructions
defineTest(addAvx512Profile) {
name = $$1
@@ -149,7 +171,7 @@ defineTest(addAvx512Profile) {
varname = QMAKE_CFLAGS_$$upname
cpu_features_missing =
- cflags = $$QMAKE_CFLAGS_AVX512F
+ cflags = $$QMAKE_CFLAGS_ARCH_HASWELL $$QMAKE_CFLAGS_AVX512F
for(part, dependencies) {
!CONFIG($$part): return() # Profile isn't supported by the compiler