aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2023-08-06 22:53:14 +0200
committerJan Hubicka <jh@suse.cz>2023-08-06 22:53:14 +0200
commit1fc96cdd0a3df2ba90a04dc507a44a02fbebd1f3 (patch)
tree19547a245d9e4e3c399c8db9b0c5bf66d8479c91
parente3e6db43640fadc9aa41c5459d43e5541d83f29a (diff)
downloadgcc-1fc96cdd0a3df2ba90a04dc507a44a02fbebd1f3.zip
gcc-1fc96cdd0a3df2ba90a04dc507a44a02fbebd1f3.tar.gz
gcc-1fc96cdd0a3df2ba90a04dc507a44a02fbebd1f3.tar.bz2
Add builtin_expect to predict that CPU supports cpuid to cpuid.h
This is needed to avoid impossible threading update in vectorizer testcase, but should also reflect reality on most CPUs we care about. gcc/ChangeLog: * config/i386/cpuid.h (__get_cpuid_count, __get_cpuid_max): Add __builtin_expect that CPU likely supports cpuid.
-rw-r--r--gcc/config/i386/cpuid.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/config/i386/cpuid.h b/gcc/config/i386/cpuid.h
index 03fd6fc..73c1548 100644
--- a/gcc/config/i386/cpuid.h
+++ b/gcc/config/i386/cpuid.h
@@ -295,7 +295,7 @@ __get_cpuid_max (unsigned int __ext, unsigned int *__sig)
: "i" (0x00200000));
#endif
- if (!((__eax ^ __ebx) & 0x00200000))
+ if (__builtin_expect (!((__eax ^ __ebx) & 0x00200000), 0))
return 0;
#endif
@@ -338,7 +338,7 @@ __get_cpuid_count (unsigned int __leaf, unsigned int __subleaf,
unsigned int __ext = __leaf & 0x80000000;
unsigned int __maxlevel = __get_cpuid_max (__ext, 0);
- if (__maxlevel == 0 || __maxlevel < __leaf)
+ if (__builtin_expect (__maxlevel == 0, 0) || __maxlevel < __leaf)
return 0;
__cpuid_count (__leaf, __subleaf, *__eax, *__ebx, *__ecx, *__edx);