This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Support for Runtime CPU type detection via builtins (issue5754058)


Hi,

On Thu, 29 Mar 2012, Sriraman Tallam wrote:

> +struct __processor_model
> +{
> +  /* Vendor. */
> +  unsigned int __cpu_is_amd : 1;
> +  unsigned int __cpu_is_intel : 1;
> +  /* CPU type. */
> +  unsigned int __cpu_is_intel_atom : 1;
> +  unsigned int __cpu_is_intel_core2 : 1;
> +  unsigned int __cpu_is_intel_corei7 : 1;
> +  unsigned int __cpu_is_intel_corei7_nehalem : 1;
> +  unsigned int __cpu_is_intel_corei7_westmere : 1;
> +  unsigned int __cpu_is_intel_corei7_sandybridge : 1;
> +  unsigned int __cpu_is_amdfam10h : 1;
> +  unsigned int __cpu_is_amdfam10h_barcelona : 1;
> +  unsigned int __cpu_is_amdfam10h_shanghai : 1;
> +  unsigned int __cpu_is_amdfam10h_istanbul : 1;
> +  unsigned int __cpu_is_amdfam15h_bdver1 : 1;
> +  unsigned int __cpu_is_amdfam15h_bdver2 : 1;
> +} __cpu_model;

It doesn't make sense for the model to be a bitfield, a processor will 
have only ever exactly one model.  Just make it an enum or even just an 
int.


Ciao,
Michael.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]