On Sunday 11 April 2010 11:43:26 zeera...@gmail.com wrote:
> On Sun, Apr 11, 2010 at 03:20:50AM +0100, Kerin Millar wrote:
> > On 10/04/2010 23:06, luis jure wrote:
> > > hello list,
> > >
> > > after many years without a hardware upgrade, i'll be receiving my new
> > > computer next week: intel i7 920 cpu, 6 GB ram, asus p6t mobo.
> > >
> > > i'm pretty excited, i imagine that at first i'll be shocked at the
> > > difference with the ancient machine i'm using now.
> > >
> > > now my question: searching a bit for the best compilation flags for
> > > this processor, i found this at gentoo-wiki:
> > >
> > > CHOST="x86_64-pc-linux-gnu"
> > > CFLAGS="-march=core2 -msse4 -mcx16 -msahf -O2 -pipe"
> > > CXXFLAGS="${CFLAGS}"
> > > (http://en.gentoo-wiki.com/wiki/Safe_Cflags/Intel)
> > >
> > > on the other hand, a thread at http://forums.gentoo.org says that the
> > > wiki page is outdated, and that -march=native should do the job without
> > > any further tweaks like -msse4 etc.
> >
> > That is correct; -march=native will indeed do the job. The CFLAGS
> > example you cite is clearly an interpretation of the flags that the
> > native target would result in anyway.
> >
> > With respect to my Intel Xeon E3113, -march=native appears to equate to:
> >
> > -march=core2 -mtune=core2 -msahf -msse4.1 --param l1-cache-size=32
> > --param l1-cache-line-size=64
> >
> > In short, use "native" and let the compiler take care of the details.
> >
> > Cheers,
> >
> > --Kerin
> 
> There's a thread in Installing Gentoo where a dev (can't remember which),
>  that says native isn't the best option, but the best option indeed is to
>  specify your arch. See these threads:
>  http://forums.gentoo.org/viewtopic-t-821639.html
> http://forums.gentoo.org/viewtopic-t-821370.html

OK, but:

$ gcc -### -march=native -E /usr/include/stdlib.h 2>&1 | grep 
"/usr/libexec/gcc/.*cc1"
 "/usr/libexec/gcc/x86_64-pc-linux-gnu/4.3.4/cc1" "-E" "-quiet" 
"/usr/include/stdlib.h" "-D_FORTIFY_SOURCE=2" "-march=core2" "-mcx16" "-msahf" 
"--param" "l1-cache-size=32" "--param" "l1-cache-line-size=64" "-mtune=core2"

the above shows that it uses smaller cache sizes than what my cpu has 
according to lshw:
==========================================
     *-cpu
          description: CPU
          product: Intel(R) Core(TM) i7 CPU       Q 720  @ 1.60GHz
          vendor: Intel Corp.
          physical id: 5
          bus info: c...@0
          version: CPU Version
          slot: U2E1
          size: 931MHz
          capacity: 4096MHz
          width: 64 bits
          clock: 133MHz
          capabilities: fpu fpu_exception wp vme de pse tsc msr pae mce cx8 
apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht 
tm pbe syscall nx rdtscp x86-64 constant_tsc arch_perfmon pebs bts rep_good 
xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx smx est tm2 
ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt lahf_lm ida tpr_shadow vnmi 
flexpriority ept vpid cpufreq
        *-cache:0
             description: L1 cache
             physical id: 6
             slot: L1 Cache
             size: 128KiB
             capacity: 128KiB
             capabilities: asynchronous internal write-through data
        *-cache:1
             description: L2 cache
             physical id: 7
             slot: L2 Cache
             size: 1MiB
             capacity: 1MiB
             capabilities: burst internal write-through unified
        *-cache:2
             description: L3 cache
             physical id: 8
             slot: L3 Cache
             size: 6MiB
             capacity: 8MiB
             capabilities: burst internal write-back
==========================================

Now, in my current cflags I have:

CFLAGS="-march=core2 -msse4 -mcx16 -msahf -O2 -pipe"

Perhaps I should stick with march=core2 and additionally be adding "--param" 
and the L0, L1, L2 cache sizes?
-- 
Regards,
Mick

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to