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: Add -m{arch,tune}=local for x86/x86-64


On Wed, Mar 15, 2006 at 02:51:53AM +0100, Michael Matz wrote:

 > +  is_amd = vendor == *(unsigned int*)"Auth";
 > +
 > +  if (is_amd)
 > +    {
 > +      if (has_mmx)
 > +        cpu = "k6";
 > +      if (has_3dnow)
 > +        cpu = "k6-3";
 > +      if (has_3dnowp)
 > +        cpu = "athlon";
 > +      if (has_sse)
 > +	cpu = "athlon-4";
 > +      if (has_sse2 || has_longmode)
 > +        cpu = "k8";
 > +    }
 > +  else
 > +    {
 > +      if (family == 5)
 > +        {
 > +          if (has_mmx)
 > +            cpu = "pentium-mmx";
 > +	}
 > +      else if (has_mmx)
 > +        cpu = "pentium2";
 > +      if (has_sse)
 > +        cpu = "pentium3";
 > +      if (has_sse2)
 > +	{
 > +	  if (family == 6)
 > +	    /* It's a pentiumpro with sse2 --> pentium-m */
 > +            cpu = "pentium-m";
 > +	  else
 > +	    /* Would have to look at extended family, but it's at least
 > +	       an pentium4 core.  */
 > +	    cpu = "pentium4";
 > +	}
 > +      if (has_sse3)
 > +        {
 > +	  if (has_longmode)
 > +	    cpu = "nocona";
 > +	  else 
 > +            cpu = "prescott";
 > +	}
 > +    }

I think this will do the wrong thing on for eg, a VIA C3.
If it isn't AMD, you can't assume it's an Intel.
I suggest changing the else to an 'else if(is_intel)',
and add a default else case that provides a safe fallback for any CPUs
that this code doesn't know about. (Transmeta, Cyrix, VIA, NexGen...)

		Dave

-- 
http://www.codemonkey.org.uk


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