This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch Ping^2: Change -mcpu to -mtune on x86
- From: Kelley Cook <KelleyCook at comcast dot net>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 20 Feb 2003 12:02:10 -0500
- Subject: Patch Ping^2: Change -mcpu to -mtune on x86
As has been discussed on the GCC list, here is a simple patch to
convert the confusing "-mcpu" to "-mtune" on the x86 platform.
It will issue a deprecation warning for use of "-mcpu", but will
still DRT.
I have respun it against the current head. Bootstrapped on i686-pc-cygwin
No new regressions after the obvious testsuite modifications were done.
Kelley Cook <no write access>
2003-02-20 Kelley Cook <kelleycook at comcast dot net>
* config/i386/i386.c: Replace "mcpu" with "mtune".
* config/i386/i386.h (TARGET_OPTIONS): Likewise.
(CC1_CPU_SPEC): Likewise. New warning for "-mcpu".
* doc/invoke.texi (i386 and x86-64 Options): Replace "mcpu"
with "mtune". Note that "mcpu" is a deprecated synonym for
"mtune".
2003-02-20 Kelley Cook <kelleycook at comcast dot net>
* g++.old-deja/g++.other/store-expr1.C: Replace "mcpu"
with "mtune".
* g++.old-deja/g++.other/store-expr2.C: Likewise.
* gcc.c-torture/execute/20010129-1.x: Likewise.
* gcc.dg/20011107-1.c: Likewise.
* gcc.dg/20020108-1.c: Likewise.
* gcc.dg/20020122-3.c: Likewise.
* gcc.dg/20020206-1.c: Likewise.
* gcc.dg/20020310-1.c: Likewise.
* gcc.dg/20020426-2.c: Likewise.
* gcc.dg/20020517-1.c: Likewise.
* gcc.dg/991230-1.c: Likewise.
* gcc.dg/i386-unroll-1.c: Likewise.
* gcc.misc-tests/i386-prefetch.exp: Likewise.
Index: config/i386/i386.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/config/i386/i386.c,v
retrieving revision 1.537
diff -u -p -r1.537 i386.c
--- config/i386/i386.c 16 Feb 2003 01:35:32 -0000 1.537
+++ config/i386/i386.c 20 Feb 2003 16:59:30 -0000
@@ -759,7 +759,7 @@ enum processor_type ix86_cpu;
enum processor_type ix86_arch;
/* Strings to hold which cpu and instruction set architecture to use. */
-const char *ix86_cpu_string; /* for -mcpu=<xxx> */
+const char *ix86_cpu_string; /* for -mtune=<xxx> */
const char *ix86_arch_string; /* for -march=<xxx> */
const char *ix86_fpmath_string; /* for -mfpmath=<xxx> */
@@ -1238,7 +1238,7 @@ override_options ()
if (processor_alias_table[i].flags & PTA_PREFETCH_SSE)
x86_prefetch_sse = true;
if (i == pta_size)
- error ("bad value (%s) for -mcpu= switch", ix86_cpu_string);
+ error ("bad value (%s) for -mtune= switch", ix86_cpu_string);
if (optimize_size)
ix86_cost = &size_cost;
Index: config/i386/i386.h
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/config/i386/i386.h,v
retrieving revision 1.322
diff -u -p -r1.322 i386.h
--- config/i386/i386.h 9 Feb 2003 23:30:51 -0000 1.322
+++ config/i386/i386.h 20 Feb 2003 16:59:36 -0000
@@ -432,7 +432,7 @@ extern int x86_prefetch_sse;
option if the fixed part matches. The actual option name is made
by appending `-m' to the specified name. */
#define TARGET_OPTIONS \
-{ { "cpu=", &ix86_cpu_string, \
+{ { "tune=", &ix86_cpu_string, \
N_("Schedule code for given CPU")}, \
{ "fpmath=", &ix86_fpmath_string, \
N_("Generate floating point mathematics using given instruction set")},\
@@ -487,15 +487,18 @@ extern int x86_prefetch_sse;
#ifndef CC1_CPU_SPEC
#define CC1_CPU_SPEC "\
-%{!mcpu*: \
-%{m386:-mcpu=i386 \
-%n`-m386' is deprecated. Use `-march=i386' or `-mcpu=i386' instead.\n} \
-%{m486:-mcpu=i486 \
-%n`-m486' is deprecated. Use `-march=i486' or `-mcpu=i486' instead.\n} \
-%{mpentium:-mcpu=pentium \
-%n`-mpentium' is deprecated. Use `-march=pentium' or `-mcpu=pentium' instead.\n} \
-%{mpentiumpro:-mcpu=pentiumpro \
-%n`-mpentiumpro' is deprecated. Use `-march=pentiumpro' or `-mcpu=pentiumpro' instead.\n}} \
+%{!mtune*: \
+%{m386:mtune=i386 \
+%n`-m386' is deprecated. Use `-march=i386' or `-mtune=i386' instead.\n} \
+%{m486:-mtune=i486 \
+%n`-m486' is deprecated. Use `-march=i486' or `-mtune=i486' instead.\n} \
+%{mpentium:-mtune=pentium \
+%n`-mpentium' is deprecated. Use `-march=pentium' or `-mtune=pentium' instead.\n} \
+%{mpentiumpro:-mtune=pentiumpro \
+%n`-mpentiumpro' is deprecated. Use `-march=pentiumpro' or `-mtune=pentiumpro' instead.\n} \
+%{mcpu=*:-mtune=%* \
+%n`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.\n}} \
+%<mcpu=* \
%{mintel-syntax:-masm=intel \
%n`-mintel-syntax' is deprecated. Use `-masm=intel' instead.\n} \
%{mno-intel-syntax:-masm=att \
@@ -525,7 +528,7 @@ extern int x86_prefetch_sse;
builtin_define_std ("i386"); \
} \
\
- /* Built-ins based on -mcpu= (or -march= if no \
+ /* Built-ins based on -mtune= (or -march= if no \
CPU given). */ \
if (TARGET_386) \
builtin_define ("__tune_i386__"); \
Index: doc/invoke.texi
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/doc/invoke.texi,v
retrieving revision 1.243
diff -u -p -r1.243 invoke.texi
--- doc/invoke.texi 20 Feb 2003 08:54:47 -0000 1.243
+++ doc/invoke.texi 20 Feb 2003 16:59:52 -0000
@@ -497,7 +497,7 @@ in the following sections.
@emph{i386 and x86-64 Options}
@gccoptlist{
--mcpu= at var{cpu-type} -march= at var{cpu-type} -mfpmath= at var{unit} @gol
+-mtune= at var{cpu-type} -march= at var{cpu-type} -mfpmath= at var{unit} @gol
-masm= at var{dialect} -mno-fancy-math-387 @gol
-mno-fp-ret-in-387 -msoft-float -msvr3-shlib @gol
-mno-wide-multiply -mrtd -malign-double @gol
@@ -7902,8 +7902,8 @@ These @samp{-m} options are defined for
computers:
@table @gcctabopt
- at item -mcpu= at var{cpu-type}
- at opindex mcpu
+ at item -mtune= at var{cpu-type}
+ at opindex mtune
Tune to @var{cpu-type} everything applicable about the generated code, except
for the ABI and the set of available instructions. The choices for
@var{cpu-type} are @samp{i386}, @samp{i486}, @samp{i586}, @samp{i686},
@@ -7923,8 +7923,12 @@ AMD chips as opposed to the Intel ones.
@item -march= at var{cpu-type}
@opindex march
Generate instructions for the machine type @var{cpu-type}. The choices
-for @var{cpu-type} are the same as for @option{-mcpu}. Moreover,
-specifying @option{-march= at var{cpu-type}} implies @option{-mcpu= at var{cpu-type}} dot
+for @var{cpu-type} are the same as for @option{-mtune}. Moreover,
+specifying @option{-march= at var{cpu-type}} implies @option{-mtune= at var{cpu-type}} dot
+ at item -mcpu= at var{cpu-type}
+ at opindex mcpu
+A deprecated synonym for @option{-mtune}.
@item -m386
@itemx -m486
@@ -7934,8 +7938,8 @@ specifying @option{-march= at var{cpu-type}
@opindex m486
@opindex mpentium
@opindex mpentiumpro
-These options are synonyms for @option{-mcpu=i386}, @option{-mcpu=i486},
- at option{-mcpu=pentium}, and @option{-mcpu=pentiumpro} respectively.
+These options are synonyms for @option{-mtune=i386}, @option{-mtune=i486},
+ at option{-mtune=pentium}, and @option{-mtune=pentiumpro} respectively.
These synonyms are deprecated.
@item -mfpmath= at var{unit}
Index: testsuite/g++.old-deja/g++.other/store-expr1.C
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/testsuite/g++.old-deja/g++.other/store-expr1.C,v
retrieving revision 1.1
diff -u -p -r1.1 store-expr1.C
--- testsuite/g++.old-deja/g++.other/store-expr1.C 25 Jan 2002 11:20:29 -0000 1.1
+++ testsuite/g++.old-deja/g++.other/store-expr1.C 20 Feb 2003 17:00:02 -0000
@@ -1,5 +1,5 @@
// Skip if not target: i?86-*-*
-// Special g++ Options: -mcpu=i686 -O2 -fpic
+// Special g++ Options: -mtune=i686 -O2 -fpic
class G {};
struct N {
Index: testsuite/g++.old-deja/g++.other/store-expr2.C
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/testsuite/g++.old-deja/g++.other/store-expr2.C,v
retrieving revision 1.1
diff -u -p -r1.1 store-expr2.C
--- testsuite/g++.old-deja/g++.other/store-expr2.C 25 Jan 2002 11:20:29 -0000 1.1
+++ testsuite/g++.old-deja/g++.other/store-expr2.C 20 Feb 2003 17:00:02 -0000
@@ -1,5 +1,5 @@
// Skip if not target: i?86-*-*
-// Special g++ Options: -mcpu=i686 -O2
+// Special g++ Options: -mtune=i686 -O2
class G {};
struct N {
Index: testsuite/gcc.c-torture/execute/20010129-1.x
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/testsuite/gcc.c-torture/execute/20010129-1.x,v
retrieving revision 1.1
diff -u -p -r1.1 20010129-1.x
--- testsuite/gcc.c-torture/execute/20010129-1.x 29 Jan 2001 18:31:35 -0000 1.1
+++ testsuite/gcc.c-torture/execute/20010129-1.x 20 Feb 2003 17:00:06 -0000
@@ -1,4 +1,4 @@
if { [istarget "i?86-*-*"] } {
- set additional_flags "-mcpu=i686"
+ set additional_flags "-mtune=i686"
}
return 0
Index: testsuite/gcc.dg/20011107-1.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/testsuite/gcc.dg/20011107-1.c,v
retrieving revision 1.1
diff -u -p -r1.1 20011107-1.c
--- testsuite/gcc.dg/20011107-1.c 9 Jan 2002 21:34:32 -0000 1.1
+++ testsuite/gcc.dg/20011107-1.c 20 Feb 2003 17:00:06 -0000
@@ -1,5 +1,5 @@
/* { dg-do compile { target i?86-*-* } } */
-/* { dg-options "-O2 -mcpu=k6" } */
+/* { dg-options "-O2 -mtune=k6" } */
void
foo (unsigned char *x, const unsigned char *y)
Index: testsuite/gcc.dg/20020108-1.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/testsuite/gcc.dg/20020108-1.c,v
retrieving revision 1.1
diff -u -p -r1.1 20020108-1.c
--- testsuite/gcc.dg/20020108-1.c 8 Jan 2002 20:10:39 -0000 1.1
+++ testsuite/gcc.dg/20020108-1.c 20 Feb 2003 17:00:06 -0000
@@ -5,7 +5,7 @@
is not valid general_operand in HImode. */
/* { dg-do compile } */
/* { dg-options "-O2" } */
-/* { dg-options "-O2 -mcpu=i686" { target i?86-*-* } } */
+/* { dg-options "-O2 -mtune=i686" { target i?86-*-* } } */
void
foo (unsigned short *cp)
Index: testsuite/gcc.dg/20020122-3.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/testsuite/gcc.dg/20020122-3.c,v
retrieving revision 1.1
diff -u -p -r1.1 20020122-3.c
--- testsuite/gcc.dg/20020122-3.c 23 Jan 2002 18:54:27 -0000 1.1
+++ testsuite/gcc.dg/20020122-3.c 20 Feb 2003 17:00:06 -0000
@@ -4,7 +4,7 @@
/* { dg-do compile } */
/* { dg-options "-Os -fprefetch-loop-arrays -w" } */
-/* { dg-options "-Os -fprefetch-loop-arrays -mcpu=pentium3 -w" { target i?86-*-* } } */
+/* { dg-options "-Os -fprefetch-loop-arrays -mtune=pentium3 -w" { target i?86-*-* } } */
int foo (int *p, int n)
{
Index: testsuite/gcc.dg/20020206-1.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/testsuite/gcc.dg/20020206-1.c,v
retrieving revision 1.1
diff -u -p -r1.1 20020206-1.c
--- testsuite/gcc.dg/20020206-1.c 6 Feb 2002 22:16:11 -0000 1.1
+++ testsuite/gcc.dg/20020206-1.c 20 Feb 2003 17:00:06 -0000
@@ -4,7 +4,7 @@
/* { dg-do run } */
/* { dg-options "-O2 -fprefetch-loop-arrays -w" } */
-/* { dg-options "-O2 -fprefetch-loop-arrays -mcpu=pentium3 -w" { target i?86-*-* } } */
+/* { dg-options "-O2 -fprefetch-loop-arrays -mtune=pentium3 -w" { target i?86-*-* } } */
struct reload
{
Index: testsuite/gcc.dg/20020310-1.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/testsuite/gcc.dg/20020310-1.c,v
retrieving revision 1.2
diff -u -p -r1.2 20020310-1.c
--- testsuite/gcc.dg/20020310-1.c 11 Mar 2002 10:12:03 -0000 1.2
+++ testsuite/gcc.dg/20020310-1.c 20 Feb 2003 17:00:06 -0000
@@ -2,7 +2,7 @@
This testcase was miscompiled because of an rtx sharing bug. */
/* { dg-do run } */
/* { dg-options "-O2" } */
-/* { dg-options "-O2 -mcpu=i586" { target i?86-*-* } } */
+/* { dg-options "-O2 -mtune=i586" { target i?86-*-* } } */
struct A
{
Index: testsuite/gcc.dg/20020426-2.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/testsuite/gcc.dg/20020426-2.c,v
retrieving revision 1.3
diff -u -p -r1.3 20020426-2.c
--- testsuite/gcc.dg/20020426-2.c 28 Apr 2002 19:48:10 -0000 1.3
+++ testsuite/gcc.dg/20020426-2.c 20 Feb 2003 17:00:06 -0000
@@ -2,7 +2,7 @@
Distilled from zlib sources. */
/* { dg-do run } */
/* { dg-options "-O2" } */
-/* { dg-options "-O2 -frename-registers -fomit-frame-pointer -fPIC -mcpu=i686" { target i?86-*-* } } */
+/* { dg-options "-O2 -frename-registers -fomit-frame-pointer -fPIC -mtune=i686" { target i?86-*-* } } */
typedef struct
{
Index: testsuite/gcc.dg/20020517-1.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/testsuite/gcc.dg/20020517-1.c,v
retrieving revision 1.1
diff -u -p -r1.1 20020517-1.c
--- testsuite/gcc.dg/20020517-1.c 22 May 2002 21:35:56 -0000 1.1
+++ testsuite/gcc.dg/20020517-1.c 20 Feb 2003 17:00:06 -0000
@@ -2,7 +2,7 @@
was not sign-extended for QImode. */
/* { dg-do run } */
/* { dg-options "-O2" } */
-/* { dg-options "-O2 -mcpu=i686" { target i?86-*-* } } */
+/* { dg-options "-O2 -mtune=i686" { target i?86-*-* } } */
#include <limits.h>
Index: testsuite/gcc.dg/991230-1.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/testsuite/gcc.dg/991230-1.c,v
retrieving revision 1.2
diff -u -p -r1.2 991230-1.c
--- testsuite/gcc.dg/991230-1.c 23 May 2000 19:30:44 -0000 1.2
+++ testsuite/gcc.dg/991230-1.c 20 Feb 2003 17:00:06 -0000
@@ -1,5 +1,5 @@
/* { dg-do run { target i?86-*-* } } */
-/* { dg-options "-O -ffast-math -mcpu=i486" } */
+/* { dg-options "-O -ffast-math -mtune=i486" } */
/* Test that floating point greater-than tests are compiled correctly with
-ffast-math. */
Index: testsuite/gcc.dg/i386-unroll-1.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/testsuite/gcc.dg/i386-unroll-1.c,v
retrieving revision 1.1
diff -u -p -r1.1 i386-unroll-1.c
--- testsuite/gcc.dg/i386-unroll-1.c 21 Nov 2002 22:08:15 -0000 1.1
+++ testsuite/gcc.dg/i386-unroll-1.c 20 Feb 2003 17:00:06 -0000
@@ -1,6 +1,6 @@
/* PR optimization/8599 */
/* { dg-do run { target i?86-*-* } } */
-/* { dg-options "-mcpu=k6 -O2 -funroll-loops" } */
+/* { dg-options "-mtune=k6 -O2 -funroll-loops" } */
extern void exit (int);
Index: testsuite/gcc.misc-tests/i386-prefetch.exp
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/testsuite/gcc.misc-tests/i386-prefetch.exp,v
retrieving revision 1.2
diff -u -p -r1.2 i386-prefetch.exp
--- testsuite/gcc.misc-tests/i386-prefetch.exp 17 Jan 2002 22:37:04 -0000 1.2
+++ testsuite/gcc.misc-tests/i386-prefetch.exp 20 Feb 2003 17:00:07 -0000
@@ -24,14 +24,14 @@
# Do not generate prefetch instructions for the following options.
set PREFETCH_NONE [list \
- { -mcpu=i386 } \
- { -mcpu=i486 } \
- { -mcpu=i586 } \
- { -mcpu=i686 } \
- { -mcpu=pentium2 } \
- { -mcpu=k6 } \
- { -mcpu=k6-2 } \
- { -mcpu=k6-3 } \
+ { -mtune=i386 } \
+ { -mtune=i486 } \
+ { -mtune=i586 } \
+ { -mtune=i686 } \
+ { -mtune=pentium2 } \
+ { -mtune=k6 } \
+ { -mtune=k6-2 } \
+ { -mtune=k6-3 } \
{ -march=i386 } \
{ -march=i486 } \
{ -march=i586 } \
@@ -40,14 +40,14 @@ set PREFETCH_NONE [list \
{ -march=k6 } ]
# For options in PREFETCH_SSE, generate SSE prefetch instructions for
-# __builtin_prefetch. This includes -mcpu for targets that treat prefetch
+# __builtin_prefetch. This includes -mtune for targets that treat prefetch
# instructions as nops.
set PREFETCH_SSE [list \
- { -mcpu=pentium3 } \
- { -mcpu=pentium4 } \
- { -mcpu=athlon } \
- { -mcpu=athlon-4 } \
+ { -mtune=pentium3 } \
+ { -mtune=pentium4 } \
+ { -mtune=athlon } \
+ { -mtune=athlon-4 } \
{ -march=pentium3 } \
{ -march=pentium4 } ]