Commit ef64d158 by Ulrich Drepper Committed by Ulrich Drepper

cpuid.h: Define signature_*_e[bcd]x macros for matching results of level 0 calls to...

gcc/
        * config/i386/cpuid.h: Define signature_*_e[bcd]x macros for
        matching results of level 0 calls to __cpuid to processor
        manufacturers.
        * config/i386/driver-i386.c (vendor_signatures): Removed.
        (processor_signatures): Removed.
        (host_detect_local_cpu): Replace uses of now-removed SIG_*
        constants with the new signature_*_ebx constants.

libstdc++-v3/
        * src/c++11/random.cc (random_device::_M_init): Use new macro
        signature_INTEL_ebx to check for Intel processors.

From-SVN: r191109
parent 7b99cca4
2012-09-09 Ulrich Drepper <drepper@gmail.com>
* config/i386/cpuid.h: Define signature_*_e[bcd]x macros for
matching results of level 0 calls to __cpuid to processor
manufacturers.
* config/i386/driver-i386.c (vendor_signatures): Removed.
(processor_signatures): Removed.
(host_detect_local_cpu): Replace uses of now-removed SIG_*
constants with the new signature_*_ebx constants.
2012-09-08 Jan Hubicka <jh@suse.cz> 2012-09-08 Jan Hubicka <jh@suse.cz>
Replace cgraph_node_set and varpool_node_set by symtab_node_encoder Replace cgraph_node_set and varpool_node_set by symtab_node_encoder
......
...@@ -75,6 +75,60 @@ ...@@ -75,6 +75,60 @@
#define bit_RDSEED (1 << 18) #define bit_RDSEED (1 << 18)
#define bit_ADX (1 << 19) #define bit_ADX (1 << 19)
/* Signatures for different CPU implementations as returned in uses
of cpuid with level 0. */
#define signature_AMD_ebx 0x68747541
#define signature_AMD_ecx 0x444d4163
#define signature_AMD_edx 0x69746e65
#define signature_CENTAUR_ebx 0x746e6543
#define signature_CENTAUR_ecx 0x736c7561
#define signature_CENTAUR_edx 0x48727561
#define signature_CYRIX_ebx 0x69727943
#define signature_CYRIX_ecx 0x64616574
#define signature_CYRIX_edx 0x736e4978
#define signature_INTEL_ebx 0x756e6547
#define signature_INTEL_ecx 0x6c65746e
#define signature_INTEL_edx 0x49656e69
#define signature_TM1_ebx 0x6e617254
#define signature_TM1_ecx 0x55504361
#define signature_TM1_edx 0x74656d73
#define signature_TM2_ebx 0x756e6547
#define signature_TM2_ecx 0x3638784d
#define signature_TM2_edx 0x54656e69
#define signature_NSC_ebx 0x646f6547
#define signature_NSC_ecx 0x43534e20
#define signature_NSC_edx 0x79622065
#define signature_NEXGEN_ebx 0x4778654e
#define signature_NEXGEN_ecx 0x6e657669
#define signature_NEXGEN_edx 0x72446e65
#define signature_RISE_ebx 0x65736952
#define signature_RISE_ecx 0x65736952
#define signature_RISE_edx 0x65736952
#define signature_SIS_ebx 0x20536953
#define signature_SIS_ecx 0x20536953
#define signature_SIS_edx 0x20536953
#define signature_UMC_ebx 0x20434d55
#define signature_UMC_ecx 0x20434d55
#define signature_UMC_edx 0x20434d55
#define signature_VIA_ebx 0x20414956
#define signature_VIA_ecx 0x20414956
#define signature_VIA_edx 0x20414956
#define signature_VORTEX_ebx 0x74726f56
#define signature_VORTEX_ecx 0x436f5320
#define signature_VORTEX_edx 0x36387865
#if defined(__i386__) && defined(__PIC__) #if defined(__i386__) && defined(__PIC__)
/* %ebx may be the PIC register. */ /* %ebx may be the PIC register. */
#if __GNUC__ >= 3 #if __GNUC__ >= 3
......
...@@ -348,17 +348,6 @@ detect_caches_intel (bool xeon_mp, unsigned max_level, ...@@ -348,17 +348,6 @@ detect_caches_intel (bool xeon_mp, unsigned max_level,
return describe_cache (level1, level2); return describe_cache (level1, level2);
} }
enum vendor_signatures
{
SIG_INTEL = 0x756e6547 /* Genu */,
SIG_AMD = 0x68747541 /* Auth */
};
enum processor_signatures
{
SIG_GEODE = 0x646f6547 /* Geod */
};
/* This will be called by the spec parser in gcc.c when it sees /* This will be called by the spec parser in gcc.c when it sees
a %:local_cpu_detect(args) construct. Currently it will be called a %:local_cpu_detect(args) construct. Currently it will be called
with either "arch" or "tune" as argument depending on if -march=native with either "arch" or "tune" as argument depending on if -march=native
...@@ -422,7 +411,7 @@ const char *host_detect_local_cpu (int argc, const char **argv) ...@@ -422,7 +411,7 @@ const char *host_detect_local_cpu (int argc, const char **argv)
model = (eax >> 4) & 0x0f; model = (eax >> 4) & 0x0f;
family = (eax >> 8) & 0x0f; family = (eax >> 8) & 0x0f;
if (vendor == SIG_INTEL) if (vendor == signature_INTEL_ebx)
{ {
unsigned int extended_model, extended_family; unsigned int extended_model, extended_family;
...@@ -483,7 +472,7 @@ const char *host_detect_local_cpu (int argc, const char **argv) ...@@ -483,7 +472,7 @@ const char *host_detect_local_cpu (int argc, const char **argv)
has_abm = ecx & bit_ABM; has_abm = ecx & bit_ABM;
has_lwp = ecx & bit_LWP; has_lwp = ecx & bit_LWP;
has_fma4 = ecx & bit_FMA4; has_fma4 = ecx & bit_FMA4;
if (vendor == SIG_AMD && has_fma4 && has_fma) if (vendor == signature_AMD_ebx && has_fma4 && has_fma)
has_fma4 = 0; has_fma4 = 0;
has_xop = ecx & bit_XOP; has_xop = ecx & bit_XOP;
has_tbm = ecx & bit_TBM; has_tbm = ecx & bit_TBM;
...@@ -497,9 +486,9 @@ const char *host_detect_local_cpu (int argc, const char **argv) ...@@ -497,9 +486,9 @@ const char *host_detect_local_cpu (int argc, const char **argv)
if (!arch) if (!arch)
{ {
if (vendor == SIG_AMD) if (vendor == signature_AMD_ebx)
cache = detect_caches_amd (ext_level); cache = detect_caches_amd (ext_level);
else if (vendor == SIG_INTEL) else if (vendor == signature_INTEL_ebx)
{ {
bool xeon_mp = (family == 15 && model == 6); bool xeon_mp = (family == 15 && model == 6);
cache = detect_caches_intel (xeon_mp, max_level, cache = detect_caches_intel (xeon_mp, max_level,
...@@ -507,7 +496,7 @@ const char *host_detect_local_cpu (int argc, const char **argv) ...@@ -507,7 +496,7 @@ const char *host_detect_local_cpu (int argc, const char **argv)
} }
} }
if (vendor == SIG_AMD) if (vendor == signature_AMD_ebx)
{ {
unsigned int name; unsigned int name;
...@@ -517,7 +506,7 @@ const char *host_detect_local_cpu (int argc, const char **argv) ...@@ -517,7 +506,7 @@ const char *host_detect_local_cpu (int argc, const char **argv)
else else
name = 0; name = 0;
if (name == SIG_GEODE) if (name == signature_NSC_ebx)
processor = PROCESSOR_GEODE; processor = PROCESSOR_GEODE;
else if (has_movbe) else if (has_movbe)
processor = PROCESSOR_BTVER2; processor = PROCESSOR_BTVER2;
......
2012-09-09 Ulrich Drepper <drepper@gmail.com>
* src/c++11/random.cc (random_device::_M_init): Use new macro
signature_INTEL_ebx to check for Intel processors.
2012-09-06 Thiago Macieira <thiago.macieira@intel.com> 2012-09-06 Thiago Macieira <thiago.macieira@intel.com>
PR libstdc++/54172 PR libstdc++/54172
......
...@@ -79,7 +79,7 @@ namespace std _GLIBCXX_VISIBILITY(default) ...@@ -79,7 +79,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
unsigned int eax, ebx, ecx, edx; unsigned int eax, ebx, ecx, edx;
// Check availability of cpuid and, for now at least, also the // Check availability of cpuid and, for now at least, also the
// CPU signature for Intel's // CPU signature for Intel's
if (__get_cpuid_max(0, &ebx) > 0 && ebx == 0x756e6547) if (__get_cpuid_max(0, &ebx) > 0 && ebx == signature_INTEL_ebx)
{ {
__cpuid(1, eax, ebx, ecx, edx); __cpuid(1, eax, ebx, ecx, edx);
if (ecx & bit_RDRND) if (ecx & bit_RDRND)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment