Reminder: MAMEdev strongly recommends using no ARCHOPTS for Intel Core-series processors (and especially 64-bit builds). They are so good that you do not need to optimize especially for them. The stock OPTIMIZE=3 is fine.
EDIT by Mr. Do November 9, 2010:
I'll leave this thread here, for posterity, but here are a couple notes regarding ARCHOPTS and current MAME builds (>2010). (Also note, I've removed the ARCHOPTS section from the compiling how-to page):
Remember, ARCHOPTS is not officially supported. No official testing is done with them, and they can be tweaked until the compiler does bad things. Looks like the new tools don't generate good code with some of them.
If you leave it blank, your builds are still optimized. Further, they are optimized in the same way the devs builds are, and thus guaranteed not to fall over.
Stop messing with the ARCHOPTS. It is silly on 64-bit. 64-bit only started showing up with the Core line of chips anyways, so it is by default already optimized for them.
FACT: Messing with optimizer flags does not make a single game playable on systems where it wasn't before.
FACT: Messing with optimizer flags is PROVEN to cause bugs (including gameplay logic errors) in games that don't have them on a normal MAME compile.
The way things are with the current toolchain, here's my not-so-definitive list of flags for ARCHOPTS, organized by newer CPU:
Intel Core 2 Solo/Duo/Quad/Extreme:
Intel Core i3/i5/i7:
ARCHOPTS="-march=core2 -mtune=generic -mssse3 -mfpmath=sse"
AMD Phenom x4/x3, Phenom II x6/x4/x3/x2, and Phenom-based Athlon X2 and Sempron:
If all else fails:
As of MAME 0.121u2, architecture flags for each CPU are no longer included in the stock makefile. You can specify them in an environment variable or command-line option to make called ARCHOPTS. Here are some useful options for a variety of IBM, Motorola and Intel CPUs. If you can think of any other options that would be useful to publish, post them in a reply to this thread.
There are two classes of options: "Maximum Tune" and "Just the Features".
"Maximum Tune" will tell the compiler about the features of the CPU, and also cause it to try to schedule instructions in such a way that the CPU pipelines are kept full. The CPUs that benefit most from this are the Intel Pentium 4, Motorola G4 7450 and IBM Cell (I know, there's no "Maximum Tune" option for this CPU yet). However, using "Maximum Tune" optimisation for x86 and x64 chips tends to bring out the bugs in GCC, so it isn't recommended for newer Intel CPUs. (Using "Maximum Tune" for PowerPC CPUs doesn't bring out the bugs - IBM and Apple have done a lot of work in this area.)
"Just the Features" will tell the compiler about optional features the CPU may have (additional FPU capabilities, vector unit, 64-bit, etc.) but won't tell it to perform scheduling optimisation. This may not be quite as fast, but it tends to be more reliable. These options are recommended for confirming bugs.
"Maximum Tune" options (i.e. architecture-specific optimisation and instruction scheduling tuning):
IBM G3 (750):
Motorola G4 (earlier - 7400, 7410, 7447, etc.):
Motorola G4 (later - 7450, etc.)
IBM G5 (970):
Intel Pentium 4 (earlier, no SSE3):
Intel Pentium 4 (later, with SSE3):
Intel Pentium 4 (later, with 64-bit capability):
Intel Pentium M, Intel Core:
Intel Core 2:
"Just the Features" options (take advantage of CPU features, but don't do fancy scheduling tricks):
IBM G3 (750):
Motorola G4 (7400, 7410, 7447, 7450, etc.):
ARCHOPTS="-mpowerpc -mpowerpc-gfxopt -maltivec"
IBM G5 (970), IBM Cell (PlayStation 3), IBM POWER5:
ARCHOPTS="-mpowerpc64 -mpowerpc-gfxopt -mpowerpc-gpopt -maltivec"
Intel Pentium 4 (earlier, no SSE3), Intel Pentium M, Intel Core:
Intel Pentium 4 (later, with SSE3), Intel Core 2:
MAME's previous options...
Pentium : ARCHOPTS = -march=pentium
I686 : ARCHOPTS = -march=pentiumpro
Athlon : ARCHOPTS = -march=athlon
AthlonXP : ARCHOPTS = -march=athlon-xp
P4 : ARCHOPTS = -march=pentium4
AMD64 : ARCHOPTS = -march=athlon64
*PM : ARCHOPTS = -march=pentium3 -msse2
*Only For Older Compiling Tools (mingw-mame-20070617.exe and earlier), Otherwise Use -march=pentium-m
Edited by twisty (11/09/10 09:23 PM)