"gcc -v" Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4/specs Configured with: /var/tmp/portage/gcc-3.3.4-r1/work/gcc-3.3.4/configure --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/3.3 --includedir=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4/include --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3 --mandir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3/man --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3/info --enable-shared --host=i686-pc-linux-gnu --target=i686-pc-linux-gnu --with-system-zlib --enable-languages=c,c++ --enable-threads=posix --enable-long-long --disable-checking --disable-libunwind-exceptions --enable-cstdio=stdio --enable-version-specific-runtime-libs --with-gxx-include-dir=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4/include/g++-v3 --with-local-prefix=/usr/local --enable-shared --enable-nls --without-included-gettext --disable-multilib --enable-__cxa_atexit --enable-clocale=generic Thread model: posix gcc version 3.3.4 20040623 (Gentoo Linux 3.3.4-r1, ssp-3.3.2-2, pie-8.7.6)
"cat /proc/cpu" processor : 0 vendor_id : AuthenticAMD cpu family : 6 model : 3 model name : AMD Duron(tm) Processor stepping : 1 cpu MHz : 756.798 cache size : 64 KB fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 1 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 sep mtrr pge mca cmov pat pse36 mmx fxsr syscall mmxext 3dnowext 3dnow bogomips : 1490.94 Playing with compiler optimizations I've found a "test-case" where "-march=athlon" produces an executable that is ~18% slower than that produced with "-march=i686". "Commands used for compilation" gcc -Wall -O2 -march=i686 -o test-i686 test.c gcc -Wall -O2 -march=athlon -o test-athlon test.c "test.c" #define N 30000 static int A[N]; static int B[N]; int main(void) { int i, j, x; for (i = 0; i < N; ++i) { x = 0; for (j=0; j < N; ++j) if (A[j] < A[i] && B[j] > x) x = A[j]; A[i] = x + 1; } return 0; } Execution time: [EMAIL PROTECTED] gcc_test $ time ./test-i686 real 0m6.149s user 0m6.015s sys 0m0.004s [EMAIL PROTECTED] gcc_test $ time ./test-athlon real 0m7.270s user 0m7.120s sys 0m0.004s Anoter interesting thing is that if I only do this change: --- test.c.orig 2004-12-22 21:52:46.208140096 +0100 +++ test.c 2004-12-22 21:55:01.069638032 +0100 @@ -10,7 +10,7 @@ for (i = 0; i < N; ++i) { x = 0; for (j=0; j < N; ++j) - if (A[j] < A[i] && B[j] > x) + if (A[j] < A[i] && A[j] > x) x = A[j]; A[i] = x + 1; } The "test-athlon" version returns fast as "test-i686" one: [EMAIL PROTECTED] gcc_test $ time ./test-i686 real 0m6.134s user 0m6.015s sys 0m0.003s [EMAIL PROTECTED] gcc_test $ time ./test-athlon real 0m6.128s user 0m6.010s sys 0m0.006s I've tried also gcc 3.4.3 and it shows the same behaviour. Shouldn't "-march=athlon" optimize for AMD K7 processors? ;-) -- Summary: march=athlon can produce slower code than march=i686 Product: gcc Version: 3.3.4 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: ornati at fastwebnet dot it CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19133