This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Add -m{arch,tune}=local for x86/x86-64
- From: Dave Jones <davej at redhat dot com>
- To: Michael Matz <matz at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 16 Mar 2006 16:45:14 -0500
- Subject: Re: Add -m{arch,tune}=local for x86/x86-64
- References: <Pine.LNX.4.58.0603150241490.12554@wotan.suse.de>
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