diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2018-06-25 16:27:48 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2018-07-09 00:18:30 +0000 |
commit | 12cf0dbfe547827a4e6a17568c8a7cccdccdded1 (patch) | |
tree | da1c9cb7eceafb990ecfcef26bf20aaf939bc5f1 /util | |
parent | 5219c37f7c98f37f078fee00fe8ca35d83ff4f5d (diff) |
SIMD: Change the way we declare constants for x86
We need to use macros because MSVC is a crappy C compiler.
Change-Id: Ieb48f7c0dd0e4e0fb35efffd153b8af62d34ebdf
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'util')
-rwxr-xr-x | util/x86simdgen/generate.pl | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/util/x86simdgen/generate.pl b/util/x86simdgen/generate.pl index 0b8ee434f8..5df2f4d526 100755 --- a/util/x86simdgen/generate.pl +++ b/util/x86simdgen/generate.pl @@ -88,20 +88,10 @@ print q{// This is a generated file. DO NOT EDIT. QT_BEGIN_NAMESPACE -// Macros for QT_FUNCTION_TARGET (for Clang and GCC)}; - -# #Define the feature string names for Clang and GCC -for my $feature (@features) { - my $str = $feature->{name}; - $str .= ",$feature->{depends}" if defined($feature->{depends}); - printf "#define QT_FUNCTION_TARGET_STRING_%-17s \"%s\"\n", - $feature->{id}, $str; -} +// used only to indicate that the CPU detection was initialized +#define QSimdInitialized (Q_UINT64_C(1) << 0)}; # Print the enum -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]; @@ -111,7 +101,13 @@ for (my $i = 0; $i < scalar @features; ++$i) { $lastleaf = $feature->{leaf}; # Feature - printf "static const quint64 CpuFeature%-13s = Q_UINT64_C(1) << %d;\n", $feature->{id}, $i + 1; + printf "#define CpuFeature%-33s (Q_UINT64_C(1) << %d)\n", $feature->{id}, $i + 1; + + # Feature string names for Clang and GCC + my $str = $feature->{name}; + $str .= ",$feature->{depends}" if defined($feature->{depends}); + printf "#define QT_FUNCTION_TARGET_STRING_%-17s \"%s\"\n", + $feature->{id}, $str; } print q{ @@ -122,9 +118,9 @@ for (my $i = 0; $i < scalar @features; ++$i) { my $feature = $features[$i]; printf "#ifdef __%s__\n" . - " | (Q_UINT64_C(1) << %d) \t// CpuFeature%s\n" . + " | CpuFeature%s\n" . "#endif\n", - $feature->{id}, $i + 1, $feature->{id}; + $feature->{id}, $feature->{id}; } print q{ ; |