# CFLAGS and Core Duo

## Darakian

After looking through what I could find on the forum and the documentation I am at a loss for what CFLAGs I should put in to the make.conf

I am tempted to put in 

"-march=pentium-m"

However I am unsure of how much the core changed in the jump from dothan to yonah. Sorry if I am missing anything this is my first time installing gentoo.

----------

## benster

Just off the top of my head I seem to remember that for a Core Duo you want to add -march=nocona to your CFLAGS. At least for the desktop version, for Centrino I don't know.

----------

## Keruskerfuerst

What type of processor is Core Duo?

For desktop or for laptop use?

----------

## benster

It's Intel's new dual core chip.

The Magic of Google reveals a result on Intel's page:

http://www.intel.com/products/processor/coreduo/

IIRC, they're based on Pentium-M which was much more power efficient than the P4s. There are mobile and desktop versions.

----------

## Darakian

Bingo core duo = marketing slogan for the dual core mobile chip (32-bit mind you). The cores name is Yonah.

----------

## robbster

 *Darakian wrote:*   

> 
> 
> I am tempted to put in 
> 
> "-march=pentium-m"
> ...

 

Just my question! Anyone a solution?   :Smile: 

----------

## digitalfrost

I have succesfully used -march=pentium-m -msse3 on my Thinkpad T60.

----------

## robbster

Yes, I did so, too and it seems to be stable.

----------

## kfiaciarka

Intel Core Duo (Yonah)

```
CHOST="i686-pc-linux-gnu"

CFLAGS="-march=pentium-m -O2 -pipe -msse3 -fomit-frame-pointer"

CXXFLAGS="${CFLAGS}"
```

according to http://gentoo-wiki.com/Safe_Cflags

----------

## SMoo

Sorry about rehashing this, but I thought someone might want to know what I've used successfully.

My make.conf:

	CFLAGS="-march=pentium-m -O2 -pipe -msse3 -fomit-frame-pointer"

	CHOST="i686-pc-linux-gnu"

	USE="X qt gnome nptl -kde cdr dvd alsa wireless"

	CXXFLAGS="${CFLAGS}"

	MAKEOPTS="-j3"

	AUTOCLEAN="yes"

----------

## tjesis

Hi all,

I also have a Intel Centrino Duo notebook. and have used the option "-march=pentium4m" succesfully.

My make.conf looks like this:

CFLAGS="-march=pentium4m -O2 -pipe -msse3"

CHOST="i686-pc-linux-gnu"

CXXFLAGS="${CFLAGS}"

MAKEOPTS="-j2"

Right now I'm in doubt which '-march'  flag I should use.

Can somebody help me to clear things up?

Thanx!

----------

## SMoo

 *Quote:*   

> MAKEOPTS="-j2" 

 

You should use -j3 so that Gentoo will make use of both CPUs...

----------

## tjesis

 *SMoo wrote:*   

>  *Quote:*   MAKEOPTS="-j2"  
> 
> You should use -j3 so that Gentoo will make use of both CPUs...

 

Thanx!!!!

I changed the /etc/make.conf to reflect MAKEOPTS="-j3"

----------

## bssteph

 *tjesis wrote:*   

> Hi all,
> 
> I also have a Intel Centrino Duo notebook. and have used the option "-march=pentium4m" succesfully.
> 
> My make.conf looks like this:
> ...

 

I'm not certain, but I'm pretty sure that "pentium4m" means the Pentium 4 M, which was just a standard P4 with SpeedStep (and, if the laptop I used to have is any indication, pretty cruddy SpeedStep at that). It predates the Pentium M line. You probably want to use pentium-m. I'm not sure if there's any difference as far as GCC is concerned though.

----------

## rhill

no, Core Duo is -march=prescott.  it supports Prescott New Instructions but not EM64T.

pentium-m sets the architecture to Pentium Pro with support for MMX, SSE, and SSE2.

pentium4 sets the architecture to Pentium 4 with support for MMX, SSE, and SSE2.

pentium-4m is identical to pentium4.  there is no difference whatsoever.

prescott sets the architecture to Nocona with support for MMX, SSE, SSE2, and SSE3.

nocona sets the architecture to Nocona with support for MMX, SSE, SSE2, SSE3, and EM64T.

Core Solo is -march=prescott.  Core Duo is -march=prescott.  Pentium D is -march=nocona.  Core Solo/Duo 2 will be -march=nocona but also have SSE4 (mni) support.  basically if you have pni in /proc/cpuinfo, use prescott.  if you have pni and lm in /proc/cpuinfo, use nocona.

----------

## P.Kosunen

```

vendor_id       : GenuineIntel

cpu family      : 6

model           : 14

model name      : Genuine Intel(R) CPU           T2300  @ 1.66GHz

stepping        : 8

cpu MHz         : 1660.000

cache size      : 2048 KB

physical id     : 0

siblings        : 2

core id         : 1

cpu cores       : 2

fdiv_bug        : no

hlt_bug         : no

f00f_bug        : no

coma_bug        : no

fpu             : yes

fpu_exception   : yes

cpuid level     : 10

wp              : yes

flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx constant_tsc pni monitor vmx est tm2 xtpr

bogomips        : 3333.62

```

No sse3 here, are you sure prescott is correct?

----------

## htranou

pni = sse3

Prescott New instructions I think. Kernel people named it pni before marketing from Intel called it SSE3, and they decided not to change it.

----------

## drsound

And what about kernel optimizations? I have an Intel Yonah dual core CPU (T2500): what should I choose as Processor type and features

/ Processor family? Pentium-4/Celeron(P4-based)/Pentium-4 M/Xeon or Pentium M?

Moreover, is the dual core technically an hyperthreading or not? If so, should I choose SMT (Hyperthreading) scheduler support?

----------

## slashdevslashtty

 *drsound wrote:*   

> Moreover, is the dual core technically an hyperthreading or not? If so, should I choose SMT (Hyperthreading) scheduler support?

 

Not hyperthreading. Just make sure SMP is enabled.

----------

## scahrossar

From the GCC-manual: 

pentium-m: Low power version of Intel Pentium3 CPU with MMX, SSE and SSE2 instruction set support.  Used by Centrino notebooks.

prescott: Improved version of Intel Pentium4 CPU with MMX, SSE, SSE2 and SSE3 instruction set support.

Allright. The Prescott is a Pentium 4 CPU, the Core Duo is a Pentium-M. 

"cat /proc/cpuinfo" reveals that it's related to the models in family 6(check out http://sandpile.org/ia32/cpuid.html to see all models in that family). In some way, it means, that the Core Duo(Yonah) actually is a modified Pentium 3 with SSE3/pni support. The closest GCC match is "-march=prescott", simply because it has support for SSE3/pni instruction set. However the system will then be optimized for a Pentium 4, which is a 7th Generation(80786) processor. It just have to be wrong. It seems a lot more logically to optimize for Pentium M(P3) with SSE3/pni support. What about these CFLAGS ?

```

CFLAGS="-march=pentium-m -O2 -pipe -fomit-frame-pointer -mfpmath=sse -msse3"

```

----------

## rhill

 *scahrossar wrote:*   

> "cat /proc/cpuinfo" reveals that it's related to the models in family 6(check out http://sandpile.org/ia32/cpuid.html to see all models in that family). In some way, it means, that the Core Duo(Yonah) actually is a modified Pentium 3 with SSE3/pni support. The closest GCC match is "-march=prescott", simply because it has support for SSE3/pni instruction set. However the system will then be optimized for a Pentium 4, which is a 7th Generation(80786) processor. It just have to be wrong. It seems a lot more logically to optimize for Pentium M(P3) with SSE3/pni support. What about these CFLAGS ?
> 
> ```
> 
> CFLAGS="-march=pentium-m -O2 -pipe -fomit-frame-pointer -mfpmath=sse -msse3"
> ...

 

You're right that the Core Duo is based on the Pentium-M microarch, but it's had some major updates done to it.  Fex, the SSE front and backend are completely redone.  On the P-M, it took twice as long to decode SSE than X87.  Core can handle up to three packed and micro-op SSE instructions at once, making using SSE the advantage.  However, when you set -march=pentium-m, GCC prefers to generate x87 instructions.

There's other changes that make Core more similar to Netburst than P-M when it comes to cost calculation, prefetch block size, etc., all of which are dependent on -march.  Check out gcc/config/i386/i386.c and the IA32 Intel Architecture Optimization Reference Manual.

----------

## pactoo

If prescottt is to prefer over pentium-m for cflags, what should I choose then for the kernel config? pentium-4 or still pentium-m? And does it make sense to also activate "check for P4 thermal throttling support" with core duo?

----------

## rhill

 *pactoo wrote:*   

> If prescottt is to prefer over pentium-m for cflags, what should I choose then for the kernel config? pentium-4 or still pentium-m? And does it make sense to also activate "check for P4 thermal throttling support" with core duo?

 

I'd choose pentium-4.

Core Solo/Duo supports both types of thermal monitoring, T1 and T2, preferring T2.  See http://www.hardwaresecrets.com/article.php?cat=&id=104 for a quick explanation of what that means.

Ref:  http://www.intel.com/design/mobile/datashts/309221.htm (Sec 2.2)

----------

## ph03n1x

Thx for all the infos guys  :Wink: 

----------

## Daemonax

This is great.

Thanks for all the info, looking at getting a core duo laptop this week, so I'll set cflags to prescott and the internal kernel processor option to Pentium-4 from what I can tell?

Hurray, looking forward to getting back in to Gentoo.   :Smile: 

----------

## LaSombra

Why MAKEOPTS should be j3 since each core is HT?

It should be capable of j5, right?

----------

## Daemonax

Are you sure they are hyperthreaded?

----------

## LaSombra

It says so...

```

iw-note ~ # cat /proc/cpuinfo

processor       : 0

vendor_id       : GenuineIntel

cpu family      : 6

model           : 14

model name      : Genuine Intel(R) CPU           T2500  @ 2.00GHz

stepping        : 8

cpu MHz         : 2001.569

cache size      : 2048 KB

physical id     : 0

siblings        : 2

core id         : 0

cpu cores       : 2

fdiv_bug        : no

hlt_bug         : no

f00f_bug        : no

coma_bug        : no

fpu             : yes

fpu_exception   : yes

cpuid level     : 10

wp              : yes

flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx constant_tsc pni monitor vmx est tm2 xtpr

bogomips        : 4005.14

processor       : 1

vendor_id       : GenuineIntel

cpu family      : 6

model           : 14

model name      : Genuine Intel(R) CPU           T2500  @ 2.00GHz

stepping        : 8

cpu MHz         : 2001.569

cache size      : 2048 KB

physical id     : 0

siblings        : 2

core id         : 1

cpu cores       : 2

fdiv_bug        : no

hlt_bug         : no

f00f_bug        : no

coma_bug        : no

fpu             : yes

fpu_exception   : yes

cpuid level     : 10

wp              : yes

flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx constant_tsc pni monitor vmx est tm2 xtpr

bogomips        : 3999.71

```

[/code]

----------

## Daemonax

Just checked mine and yes you're right, if 'ht' is hyper threading.

I guess if it shows up in a cat /proc/cpuinfo that ht is turned on then? Hmm, but wouldn't that meant that cat /proc/cpuinfo would show 4 cpu's?

----------

## LaSombra

I tried to recompile my kernel to allow HT and 4 CPUs, but didn't work  :Sad: 

Anyone knows if it's possible?

----------

## fusel

Cure Duo (1) (Yonah) is not capable of hyperthreading, nor does it support 64bit instructions. Instead, it features 2 real cores which are "featuring" a shared cache. According to some guys, this could be useful in some situations while beeing a showstopper in others.

----------

## raid517

Wait I am still confused. There seems to be a lot of very conflicting opinion here. I am in the process of setting my use flags for my core duo laptop.

Can anybody give the definitive word on what settings I really should use - and which might be optional?

----------

## Brendenm

Hyperthreading requires more then just the processor supporting it, it requires the chipset and such to also.

I just ran the official Intel chipset, processor & hyperthreading utilities on my Dell Latitude D820 /w T2400 and it DOES NOT support HyperThreading according to Intel.

So far from another thread this is what I found for the CFLAGS

```

CHOST="i686-pc-linux-gnu"

CFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer"

MAKEOPTS="-j3"

```

My question is, what does prescott turn on?  do I need to include all of the sse flags (sse, sse2, sse3), I know core2 does this?

----------

## Mehlano

Hi genties!  :Smile: 

So I guess, nocona is the right -march for my Pentium D 820 with a smithfield core... right?

```
processor       : 0

vendor_id       : GenuineIntel

cpu family      : 15

model           : 4

model name      : Intel(R) Pentium(R) D CPU 2.80GHz

stepping        : 7

cpu MHz         : 2810.204

cache size      : 1024 KB

physical id     : 0

siblings        : 2

core id         : 0

cpu cores       : 1

fdiv_bug        : no

hlt_bug         : no

f00f_bug        : no

coma_bug        : no

fpu             : yes

fpu_exception   : yes

cpuid level     : 3

wp              : yes

flags           : fpu 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 nx lm constant_tsc pni monitor ds_cpl cid cx16 xtpr lahf_lm

bogomips        : 5624.03

processor       : 1

vendor_id       : GenuineIntel

cpu family      : 15

model           : 4

model name      : Intel(R) Pentium(R) D CPU 2.80GHz

stepping        : 7

cpu MHz         : 2810.204

cache size      : 1024 KB

physical id     : 0

siblings        : 2

core id         : 0

cpu cores       : 1

fdiv_bug        : no

hlt_bug         : no

f00f_bug        : no

coma_bug        : no

fpu             : yes

fpu_exception   : yes

cpuid level     : 3

wp              : yes

flags           : fpu 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 nx lm constant_tsc pni monitor ds_cpl cid cx16 xtpr lahf_lm

bogomips        : 5620.13
```

----------

## bewst

 *dirtyepic wrote:*   

> 
> 
> You're right that the Core Duo is based on the Pentium-M microarch, but it's had some major updates done to it.  Fex, the SSE front and backend are completely redone.  On the P-M, it took twice as long to decode SSE than X87.  Core can handle up to three packed and micro-op SSE instructions at once, making using SSE the advantage.  However, when you set -march=pentium-m, GCC prefers to generate x87 instructions.
> 
> There's other changes that make Core more similar to Netburst than P-M when it comes to cost calculation, prefetch block size, etc., all of which are dependent on -march.  Check out gcc/config/i386/i386.c and the IA32 Intel Architecture Optimization Reference Manual.

 

Someone I respect claims that P-M is still a more appropriate choice (http://jmaurer.awardspace.info/e8210/).  What do you think of his argument?

----------

## Dirk.R.Gently

My Core Duo uses only one processor for many different tasks.  Is this because of a misconfiguration, or do apps need to be programmed to use it?  For example, compiling will use both processors, but this won't happen when I'm browsing with Firefox.  I used prescott and my kernel is has 2 processors selected.

----------

## Akkara

 *Quote:*   

> My Core Duo uses only one processor for many different tasks. Is this because of a misconfiguration [...] 

 

To use more than one core, the app must be written in a multi-threaded manner, and most simple apps aren't.

Compiling uses both cores only because the make script fires off more than one compilation at a time (that's the MAKEOPTS="-j3" option in make.conf)

GUI apps tend to use multiple threads but the division is usually a UI thread and a work thread.  So you'll see some use of both cores if the UI updates while work is being done.  But unless the work itself is split into two (or more) threads and they are reasonably equally balanced, only one core will be busy most of the time.

I had run into this issue also.  If you have a lot of scripting-type of stuff to do consisting of independent commands working on separate files and you'd like a way to use both cores, perhaps this parallelizing shell-feeding script might be of interest.  It does no dependency checking whatsoever, nor any locking or synchronization, so it is only useful if you have a long list of independent work to do.

----------

## Dirk.R.Gently

Much obliged, Akkara.  I wonder about that.

Well I decided to try march pentium-m as suggested in the above post.  It'll be months before I'll ever see any output from it as my system is pretty up to date.  I did test some of the additional CFLAGS though ( -malign-double -mregparm=3  -msseregparm -m128bit-long-double ).  I decided to test totem as it's been known to a little bit picky about what flags are set.  With -malign-double and -mregparm=3 would emerge but totem wouldn't run.  -msseregparm worked but broke sliders in gnome.  So here is my current CFLAGS line.  

CFLAGS="-O2 -march=pentium-m -msse3 -mfpmath=sse -m128bit-long-double -fomit-frame-pointer -pipe"

Totem is seems to work nicely.

----------

## xevilstar

the core duo support is in the latest kernels as core duo

----------

## Master Shake

 *xevilstar wrote:*   

> the core duo support is in the latest kernels as core duo

 

Sure that isn't Core 2 Duo?

----------

## Dirk.R.Gently

I got a brain today.  I just noticed that I didn't have the "threads" USE flag in my make.conf.  It doesn't change that many apps but it's nice I found out.

----------

## minor_prophets

 *pactoo wrote:*   

> If prescottt is to prefer over pentium-m for cflags, what should I choose then for the kernel config? pentium-4 or still pentium-m? And does it make sense to also activate "check for P4 thermal throttling support" with core duo?

 

I've used prescott in my make.conf and pentium m in the kernel since about the time of your post with no problems.  I'm compiling my 2.6.23-r3 kernel right now with Pentium-4 as the Processor option based on dirtyepic's response to your post to take a peek at what happens.

My Family 6 Model 14 Prescott

```
CFLAGS="-march=prescott -O2 -pipe"

CHOST="i686-pc-linux-gnu"

CXXFLAGS="${CFLAGS}"

MAKEOPTS="-j3"

```

----------

## cognhuepan

hey! I'm lost here, I have an Intel Centrino Duo Processor

#cat /proc/cpuinfo shows:

```
processor       : 0

vendor_id       : GenuineIntel

cpu family      : 6

model           : 15

model name      : Intel(R) Core(TM)2 Duo CPU     T5250  @ 1.50GHz

stepping        : 13

cpu MHz         : 1000.000

cache size      : 2048 KB

physical id     : 0

siblings        : 2

core id         : 0

cpu cores       : 2

fpu             : yes

fpu_exception   : yes

cpuid level     : 10

wp              : yes

flags           : fpu 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 syscall nx lm constant_tsc pni monitor ds_cpl est tm2 ssse3 cx16 xtpr lahf_lm

bogomips        : 3003.17

clflush size    : 64

cache_alignment : 64

address sizes   : 36 bits physical, 48 bits virtual

power management:

processor       : 1

vendor_id       : GenuineIntel

cpu family      : 6

model           : 15

model name      : Intel(R) Core(TM)2 Duo CPU     T5250  @ 1.50GHz

stepping        : 13

cpu MHz         : 1000.000

cache size      : 2048 KB

physical id     : 0

siblings        : 2

core id         : 1

cpu cores       : 2

fpu             : yes

fpu_exception   : yes

cpuid level     : 10

wp              : yes

flags           : fpu 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 syscall nx lm constant_tsc pni monitor ds_cpl est tm2 ssse3 cx16 xtpr lahf_lm

bogomips        : 2999.68

clflush size    : 64

cache_alignment : 64

address sizes   : 36 bits physical, 48 bits virtual

power management:

```

But, I'm not sure what kind of architecture is mine, it's 32 or 64 bits??

'so no más

-j-

----------

