diff options
Diffstat (limited to 'util')
-rwxr-xr-x | util/x86simdgen/generate.pl | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/util/x86simdgen/generate.pl b/util/x86simdgen/generate.pl index 572891d483..0b8ee434f8 100755 --- a/util/x86simdgen/generate.pl +++ b/util/x86simdgen/generate.pl @@ -99,33 +99,32 @@ for my $feature (@features) { } # Print the enum -printf "\nenum CPUFeatures {"; +print q{ +// used only to indicate that the CPU detection was initialized +static const quint64 QSimdInitialized = Q_UINT64_C(1) << 0;}; my $lastleaf; for (my $i = 0; $i < scalar @features; ++$i) { my $feature = $features[$i]; # Leaf header: - printf "\n // in %s:\n", $leaves{$feature->{leaf}} + printf "\n// in %s:\n", $leaves{$feature->{leaf}} if $feature->{leaf} ne $lastleaf; $lastleaf = $feature->{leaf}; # Feature - printf " CpuFeature%-13s = %d,\n", $feature->{id}, $i + 1; + printf "static const quint64 CpuFeature%-13s = Q_UINT64_C(1) << %d;\n", $feature->{id}, $i + 1; } print q{ - // used only to indicate that the CPU detection was initialized - QSimdInitialized = 1 -\}; - static const quint64 qCompilerCpuFeatures = 0}; # And print the compiler-enabled features part: -for my $feature (@features) { +for (my $i = 0; $i < scalar @features; ++$i) { + my $feature = $features[$i]; printf "#ifdef __%s__\n" . - " | (Q_UINT64_C(1) << CpuFeature%s)\n" . + " | (Q_UINT64_C(1) << %d) \t// CpuFeature%s\n" . "#endif\n", - $feature->{id}, $feature->{id}; + $feature->{id}, $i + 1, $feature->{id}; } print q{ ; @@ -149,7 +148,7 @@ if (my $cpp = shift @ARGV) { print "// This is a generated file. DO NOT EDIT."; print "// Please see util/x86simdgen/generate.pl"; -print "#include <qglobal.h>"; +print '#include "qsimd_p.h"'; print ""; # Now generate the string table and bit-location array @@ -189,4 +188,16 @@ for (my $j = 0; $j < scalar @features; ++$j) { $feature->{leaf}, $feature->{bit}; $lastname = $feature->{name}; } -print " // $lastname\n};"; +printf qq{ // $lastname +\}; + +// List of AVX512 features (see detectProcessorFeatures()) +static const quint64 AllAVX512 = 0}; + +# Print AVX512 features +for (my $j = 0; $j < scalar @features; ++$j) { + my $feature = $features[$j]; + $_ = $feature->{id}; + printf "\n | CpuFeature%s", $_ if /AVX512/; +} +print ";"; |