Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
CFLAGS determination script
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2, 3  Next  
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
ollie
n00b
n00b


Joined: 24 Nov 2002
Posts: 35

PostPosted: Thu Jun 19, 2003 10:52 am    Post subject: Reply with quote

Terminal wrote:
Well, the script works, although it is detecting my duron as being -march=athlon instead of being -march=athlon-tbird ... weird.


a duron is in no way a tbird so why is it wierd?
Back to top
View user's profile Send private message
bsolar
Bodhisattva
Bodhisattva


Joined: 12 Jan 2003
Posts: 2764

PostPosted: Fri Jun 20, 2003 1:27 pm    Post subject: Re: GCC 3.2 problems w/ P4 and SSE2 Reply with quote

xunil wrote:
GCC 3.2 (the default GCC in Gentoo 1.4) generates bad SSE2 code. You should use -march=pentium3 for Pentium 4s and also omit -msse2 for GCC 3.2 and below, but GCC 3.3 fixes this.

gcc-3.2.3 solves the issue too.
_________________
I may not agree with what you say, but I'll defend to the death your right to say it.
Back to top
View user's profile Send private message
xunil
n00b
n00b


Joined: 18 Jun 2003
Posts: 36
Location: Blacksburg, VA, USA

PostPosted: Fri Jun 20, 2003 2:59 pm    Post subject: Re: GCC 3.2 problems w/ P4 and SSE2 Reply with quote

bsolar wrote:
xunil wrote:
GCC 3.2 (the default GCC in Gentoo 1.4) generates bad SSE2 code. You should use -march=pentium3 for Pentium 4s and also omit -msse2 for GCC 3.2 and below, but GCC 3.3 fixes this.

gcc-3.2.3 solves the issue too.


Oh, then it's time to rebuild. :P Still, the script should check for this b/c I've personally had some terrible experiences w/ crashing code using earlier versions of GCC 3.2 when I wasn't aware of this bug.
Back to top
View user's profile Send private message
Arafaen
n00b
n00b


Joined: 16 Jun 2003
Posts: 8
Location: Kingston, Ontario

PostPosted: Fri Jun 20, 2003 3:23 pm    Post subject: Reply with quote

cromozon wrote:
Im going to use this in a script that one day should be able to configure the kernel automatic, it's GREAT :D


While I agree that this would be an absolutely fantastic script to have, I really don't think it's possible to make it general enough to work. In particular, I think it will inevitably lead to chicken-and-egg problems. If, for example, USB support is not already compiled into the kernel, then from within Linux no user application will be able to detect that the machine actually supports USB. In essence, there would be a lot of situations where, in order to tell that support for a given type of device is needed in the kernel, that support would already have to be present in the kernel.

-chris
Back to top
View user's profile Send private message
raid517
l33t
l33t


Joined: 06 Mar 2003
Posts: 946

PostPosted: Mon Jun 23, 2003 2:10 pm    Post subject: Reply with quote

How about this for a total n00b... :oops: How exactly do you get that script to work? I've seen executable scripts before, but runing those is easy. What do I do? Make a text file or something and paste the script into it? Also can that script be adapted so that it actually creates a unique make.conf file for each users individual systems? I know some guys are working on a Gentoo installer and would probably appreciate this.

Q
Back to top
View user's profile Send private message
ChadRock!
n00b
n00b


Joined: 20 Jun 2003
Posts: 3

PostPosted: Wed Jun 25, 2003 4:02 pm    Post subject: Yeah! Good questions Raid517 Reply with quote

I had the same thoughts Raid517. I'm a nube. How do you make scripts?

Good questions:

1. "What do I do? Make a text file or something and paste the script into it?"
2. "Can that script be adapted so that it actually creates a unique make.conf file for each users individual systems?"
Back to top
View user's profile Send private message
s3ntient
Guru
Guru


Joined: 13 Apr 2003
Posts: 304
Location: Lyon, France

PostPosted: Wed Jun 25, 2003 10:14 pm    Post subject: Reply with quote

Basically past it all into a file called say cflag_script , put that file into /usr/bin then do
chmod +x /usr/bin/cflag_script
then you can just type cflag_script in a console and i'll execute giving you the output of the script.
_________________
http://blog.chaostrophy.org
Back to top
View user's profile Send private message
gandalf2041
n00b
n00b


Joined: 28 Jun 2003
Posts: 47

PostPosted: Sat Jun 28, 2003 3:01 pm    Post subject: Reply with quote

I've followed the instructions in this thread to get the script up and running; however, I get either:

RAND bin # ./cflags_script
:bad interpreter: No such file or directory OR

RAND bin #bash cflags_script
:command not found 2:
:command not found 4:
:command not found 7:
:command not found 10:
:command not found 12:
cflags_script: line 21: syntax error near unexpected token 'elif'
'flags_script: line 21: ' elif [ "$name" == "cpu family" ]; then

this is a BRAND new Gentoo 1.4 install on a Wintel P4 1.8 GHz (I haven't even installed X). Any help would be greatly appreciated.
Back to top
View user's profile Send private message
maxilion
n00b
n00b


Joined: 19 Jun 2002
Posts: 34
Location: Belgium

PostPosted: Sat Jun 28, 2003 7:06 pm    Post subject: Reply with quote

gandalf2041 wrote:
I've followed the instructions in this thread to get the script up and running; however, I get either:

RAND bin # ./cflags_script
:bad interpreter: No such file or directory OR

RAND bin #bash cflags_script
:command not found 2:
:command not found 4:
:command not found 7:
:command not found 10:
:command not found 12:
cflags_script: line 21: syntax error near unexpected token 'elif'
'flags_script: line 21: ' elif [ "$name" == "cpu family" ]; then

this is a BRAND new Gentoo 1.4 install on a Wintel P4 1.8 GHz (I haven't even installed X). Any help would be greatly appreciated.


Edit the script and make sure you haven't got any spaces before the commands. By example copy & pasting from konqueror inserts one space in the beginnen of every line. This has to be deleted for the script to work.

Maxillion
Back to top
View user's profile Send private message
gandalf2041
n00b
n00b


Joined: 28 Jun 2003
Posts: 47

PostPosted: Sat Jun 28, 2003 11:31 pm    Post subject: Reply with quote

That did it. Looks like I had an extra return at the end. Thanks!

BTW: Output ---> -march=pentium4 -mfpmath=sse -msse2 -mmmx :D
Back to top
View user's profile Send private message
ChadRock!
n00b
n00b


Joined: 20 Jun 2003
Posts: 3

PostPosted: Fri Jul 04, 2003 9:00 pm    Post subject: course Reply with quote

Thanks for the patience people. I took a Redhat Linux course and learned some basics, like chmod and scipts, so I know how to make scripts now.

The class did not go into compiling yet, so I'm afraid Gentoo is a little over my head still.

I compiled Gentoo ok following the ix86 install instructions and got a bootable system. The problem is, I understood what was going on up until compiling the kernel. That was the point at which the instructions lose beginners like me.

It did not specify exactly what to do step by step, so I could understand, and thus I was lost from that point on. I was not sure what to pick in the kernel. Also, I was not sure that if I chose some options, whether or not the defaults apply along with what you change or if they don't apply at all if I make any changes.

I was following along fine until that point. My system booted up but I did not have basic apps and commands working. Maybe it was a pathing problem. I did not know if I had all of the packages I wanted or needed. I did not know what to chose from. I guess that's the way it is huh? It seems like the instructions were step by step dummy proof up until the kernel compile.

I just don't seem to be geek enough to figure it out like you guys do yet. But hopefully in a year or two I will be.
Back to top
View user's profile Send private message
rinnan
Tux's lil' helper
Tux's lil' helper


Joined: 24 May 2003
Posts: 138
Location: Honolulu, Hawai`i

PostPosted: Fri Jul 11, 2003 7:04 am    Post subject: Okay got it to work Reply with quote

Cut-n-paste it into Kate, from Konqueror, which works but will preserve the HTML encoding as control characters. To eliminate them, so that the script can be run, follow these instructions.

First, choose "Select All" from the "Edit" menu in Kate. Then, select "Clean Indentation" from Kate's "Tool" menu. This eliminates the starting blank character on each line. Next we have to change the indents to something that doesn't confuse /bin/sh. On line #15 of the script is "unset IFS", if you cut-n-pasted it exactly from the first text line. It's the middle line in the following list of lines:

Quote:
IFS=":"
while read name value; do
    unset IFS
    name=`echo $name`
    value=`echo $value`


Carefully select the whitespace between the beginning of the line and the first character, the "u" on the line. Don't select the "u" however, but be sure to get every blank character including the first one.

Then choose the "Replace Text" from Kate's "Edit" pull-down menu.

The text you want to replace is the indentation itself. It is already entered and highlighted for you, in the "Text to Find" box, so you don't need to do anything else there. Click in the "Replacement Text" box and type four spaces. Then, select the "Ok" button, which will do the work. If you did exactly what I did you will get the message box, "224 replacements made".

Save it (as "cflags.sh" for example), then, in the shell, execute the following command to run it:

Quote:
bash-2.05b$ . cflags.sh
-march=pentium3 -mfpmath=sse -msse -mmmx
bash-2.05b$


Don't forget the little period and space before the "cflags.sh". That will cause bash to execute a script without it having to be executable.

Alternatively you can make it executable such that it executes exactly like any other Linux script -- type this:

Quote:
bash-2.05b$ chmod +x cflags.sh
bash-2.05b$


My machine is a Nehemiah M10000 from Via. The /cpu/proc is:

Quote:

bash-2.05b$ cat /proc/cpuinfo
processor : 0
vendor_id : CentaurHauls
cpu family : 6
model : 9
model name : VIA Nehemiah
stepping : 1
cpu MHz : 999.453
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 1
wp : yes
flags : fpu de tsc msr mtrr pge cmov mmx fxsr sse
bogomips : 1986.56

Erik
Back to top
View user's profile Send private message
fastus eddius
n00b
n00b


Joined: 19 Jul 2003
Posts: 10

PostPosted: Sat Jul 19, 2003 1:28 am    Post subject: working cflags for Eden C3-2/Nehemiah (Via M10000) mini-itx Reply with quote

(hope i got all the relevant keywords in there other than epia)

i successfully completed a stage3 install of gentoo 1.4. emerge -u world worked without a hitch and the system seems stable. audio and X work thanks to various members in this forum.

related cpu/compiler settings are as follows:

gcc version 3.2.3 20030422 (Gentoo Linux 1.4 3.2.3-r1, propolice)

CHOST="i686-pc-linux-gnu"
CFLAGS="-march=pentium3 -mfpmath=sse -msse -mmmx -O3 -pipe -fomit-frame-pointer
-fprefetch-loop-arrays -fforce-addr -falign-functions=4"

Eden C3-2/Nehemiah (Via M10000)

$ cat /proc/cpuinfo
processor : 0
vendor_id : CentaurHauls
cpu family : 6

model : 9
model name : VIA Nehemiah
stepping : 1
cpu MHz : 999.550
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 de tsc msr mtrr pge cmov mmx fxsr sse
bogomips : 1992.29

fwiw, the cflags script gave the following output for this cpu - i just added the rest to see if i could get away with it:
-march=pentium3 -mfpmath=sse -msse -mmmx
Back to top
View user's profile Send private message
regeya
Apprentice
Apprentice


Joined: 28 Jul 2002
Posts: 270
Location: Desoto, IL, USA

PostPosted: Fri Oct 31, 2003 11:00 pm    Post subject: Re: working cflags for Eden C3-2/Nehemiah (Via M10000) mini- Reply with quote

fastus eddius wrote:
(hope i got all the relevant keywords in there other than epia)

i successfully completed a stage3 install of gentoo 1.4. emerge -u world worked without a hitch and the system seems stable. audio and X work thanks to various members in this forum.

related cpu/compiler settings are as follows:

gcc version 3.2.3 20030422 (Gentoo Linux 1.4 3.2.3-r1, propolice)

CHOST="i686-pc-linux-gnu"
CFLAGS="-march=pentium3 -mfpmath=sse -msse -mmmx -O3 -pipe -fomit-frame-pointer
-fprefetch-loop-arrays -fforce-addr -falign-functions=4"

Eden C3-2/Nehemiah (Via M10000)


I've got an Ezra, which doesn't have the same featureset. The advice I got was to use flags much as one would for a K6-3. If I ever have to emerge -e world, I'm changing one thing: -O3 to -Os. Like your processor, mine has 64kb of cache.
Code:

bash-2.05b$ cat /proc/cpuinfo
processor       : 0
vendor_id       : CentaurHauls
cpu family      : 6
model           : 8
model name      : VIA C3 Ezra
stepping        : 9
cpu MHz         : 1003.866
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 de tsc msr cx8 mtrr pge mmx 3dnow
bogomips        : 1966.08
Back to top
View user's profile Send private message
Autie
Guru
Guru


Joined: 25 Jul 2003
Posts: 309
Location: Ledegem - Belgium

PostPosted: Thu Dec 18, 2003 8:22 pm    Post subject: cflag script Reply with quote

i get errors after is set my echo from that script in my make.conf.
Code:

pentium4 -mfpmath=sse -msse2 -mmmx

That was my output from that script, so i set my CFLAG to:
Code:

CFLAGS="-march=pentium4 -O3 -pipe -fomit-frame-pointer -mfpmath=sse -msse2 -mmmx"

So, i emerge -e world, and all go well, until i emerge libvorbis.
there i get errors, which i don't have with CFLAGS="-march=pentium4 -O3 -pipe -fomit-frame-pointer"

Any ideas why i get errors?
Back to top
View user's profile Send private message
Autie
Guru
Guru


Joined: 25 Jul 2003
Posts: 309
Location: Ledegem - Belgium

PostPosted: Thu Dec 18, 2003 8:22 pm    Post subject: cflag script Reply with quote

i get errors after is set my echo from that script in my make.conf.
Code:

pentium4 -mfpmath=sse -msse2 -mmmx

That was my output from that script, so i set my CFLAG to:
Code:

CFLAGS="-march=pentium4 -O3 -pipe -fomit-frame-pointer -mfpmath=sse -msse2 -mmmx"

So, i emerge -e world, and all go well, until i emerge libvorbis.
there i get errors, which i don't have with CFLAGS="-march=pentium4 -O3 -pipe -fomit-frame-pointer"

Any ideas why i get errors?
Back to top
View user's profile Send private message
Autie
Guru
Guru


Joined: 25 Jul 2003
Posts: 309
Location: Ledegem - Belgium

PostPosted: Thu Dec 18, 2003 8:24 pm    Post subject: cflag script Reply with quote

i get errors after is set my echo from that script in my make.conf.
Code:

pentium4 -mfpmath=sse -msse2 -mmmx

That was my output from that script, so i set my CFLAG to:
Code:

CFLAGS="-march=pentium4 -O3 -pipe -fomit-frame-pointer -mfpmath=sse -msse2 -mmmx"

So, i emerge -e world, and all go well, until i emerge libvorbis.
there i get errors, which i don't have with CFLAGS="-march=pentium4 -O3 -pipe -fomit-frame-pointer"

Any ideas why i get errors?
Back to top
View user's profile Send private message
RikBlankestijn
Guru
Guru


Joined: 01 May 2003
Posts: 315
Location: Arnhem the Netherlands

PostPosted: Tue Dec 23, 2003 3:31 pm    Post subject: doing emerge -e world right now Reply with quote

If I've done emerge -e world with these new flags and everything has been successfully compiled does mean your system will be ok? Or are there other things to think of?
Back to top
View user's profile Send private message
j11888
n00b
n00b


Joined: 16 Dec 2003
Posts: 5

PostPosted: Tue Dec 23, 2003 6:22 pm    Post subject: Reply with quote

am i the only one who nano will indent (untill it gets off teh screen) everything thats copyed into it from gnome-terminal?

anyways, i ran it on a celderon copermine and got:
-march=pentium3 -mfpmath=sse -msse -mmmx

im gonna use "-march=pentium3 -mfpmath=sse,387 -msse -mmmx -O3 -pipe -fomit-frame-pointer" unless anyone can think of a reason not to

being 2 lazy to recompile everything, ill just use the "emerge -Uu -v --oneshot `qpkg -I -nc`" from another topic and wind up recompiling everything sooner or later.

Quote:

Thanks for the patience people. I took a Redhat Linux course and learned some basics, like chmod and scipts, so I know how to make scripts now.
The class did not go into compiling yet, so I'm afraid Gentoo is a little over my head still.
I compiled Gentoo ok following the ix86 install instructions and got a bootable system. The problem is, I understood what was going on up until compiling the kernel. That was the point at which the instructions lose beginners like me.
It did not specify exactly what to do step by step, so I could understand, and thus I was lost from that point on. I was not sure what to pick in the kernel. Also, I was not sure that if I chose some options, whether or not the defaults apply along with what you change or if they don't apply at all if I make any changes.
I was following along fine until that point. My system booted up but I did not have basic apps and commands working. Maybe it was a pathing problem. I did not know if I had all of the packages I wanted or needed. I did not know what to chose from. I guess that's the way it is huh? It seems like the instructions were step by step dummy proof up until the kernel compile.


Tip: dont learn from classes, theres a world of books and howtos more useful then any teacher i no of

to install the kernel just choose wat source u want (gentoo-sources may b best if u dont no teh differances) and then emerge genkernel.

the thing thats confusing me bout ur post is that u couldn't compile the kernel cuz u couldn't figure out how from the instruction, yet u could still boot it>? also, wat do u mean when u say that basic apps and commands dont work? u got to emerge stuff like gnome b4 u use it (this aint redhat w/ the rpm ;) )

BTW: Zyklon, thx for the great script
Back to top
View user's profile Send private message
fincoop
Tux's lil' helper
Tux's lil' helper


Joined: 02 Feb 2004
Posts: 131

PostPosted: Sat May 08, 2004 7:27 am    Post subject: Reply with quote

I edited make.conf, and then emerged a new package (portage), and it didn't use the new settings. I copy/pasted the CFLAGS line from make.conf into my shell and then emerged another package and it worked. Do I need to have the CFLAGS variable loaded into memory for them to apply?
Back to top
View user's profile Send private message
bravecobra
Tux's lil' helper
Tux's lil' helper


Joined: 26 Dec 2002
Posts: 130
Location: Planet Earth (sometimes)

PostPosted: Sat May 08, 2004 12:35 pm    Post subject: Reply with quote

xunil wrote:
GCC 3.2 (the default GCC in Gentoo 1.4) generates bad SSE2 code. You should use -march=pentium3 for Pentium 4s and also omit -msse2 for GCC 3.2 and below, but GCC 3.3 fixes this.

The script generates this:
Code:
-march=pentium4 -mfpmath=sse -msse2 -mmmx

Here is my /proc/cpuinfo
Code:
bash-2.05b$ cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 15
model           : 2
model name      : Intel(R) Pentium(R) 4 CPU 2.40GHz
stepping        : 4
cpu MHz         : 2400.084
cache size      : 512 KB
physical id     : 0
siblings        : 1
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 2
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm
bogomips        : 4734.97

_________________
Brave Cobra
http://www.bravecobra.com
Back to top
View user's profile Send private message
vdboor
Guru
Guru


Joined: 03 Dec 2003
Posts: 592
Location: The Netherlands

PostPosted: Mon May 10, 2004 11:53 am    Post subject: Reply with quote

Cool script! If this matures, I hope it will be in on the gentoo-install cd by default.. ;)

I was wondering if there is any way to specify what kind of usage one has in mind for their system. Because I have an AMD Athlon XP, I used to compile with -O3. Unfortunately, this takes ages to compile, and programs load slow (execute fast). Because I have a desktop, I want programs to load fast, so I use -Os.
There is one thing though, korganizer (kdepim package) seams to give a problem with -Os, this has been reported at bugs.kde.org as well.. That's why I use -O2 today: stable and safe.

Conclusion: could there be three options?

"What would you like to optimize your system for:"
- Slow application startup, fast execution (-O3)
- Small binaries (-Os)
- Safe and stable (-O2)
_________________
The best way to accelerate a windows server is by 9.81M/S²
Linux user #311670 and Yet Another Perl Programmer

[ screenies | Coding on KMess ]
Back to top
View user's profile Send private message
dalek
Veteran
Veteran


Joined: 19 Sep 2003
Posts: 1337
Location: Mississippi USA

PostPosted: Mon May 10, 2004 12:54 pm    Post subject: Reply with quote

I have a Athlon XP 2500+. Here is what it gave me in case you need to make a adjustment. Looks akay to me but what do I know??

Code:
root@smoker /proc # cat /proc/cpuinfo
processor       : 0
vendor_id       : AuthenticAMD
cpu family      : 6
model           : 10
model name      : AMD Athlon(tm) XP 2500+
stepping        : 0
cpu MHz         : 1829.934
cache size      : 512 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 apic sep mtrr pge mca cmov pat pse36 mmx fxsr sse syscall mmxext 3dnowext 3dnow
bogomips        : 3620.86

root@smoker /proc # /home/dale/Desktop/CFLAGS-script
 -march=athlon-xp -mfpmath=sse -msse -mmmx -m3dnow
root@smoker /proc #


Oh, make.conf snippets:

Code:
CFLAGS="-O3 -march=athlon-xp -fmove-all-movables -fprefetch-loop-arrays -funroll-loops -fomit-frame-pointer -ffast-math -pipe"


Read that somewhere in the forum. <shruggs shoulders> It works.

Later

8O :D :D :D
_________________
My rig: Gigabyte GA-970A-UD3P mobo, AMD FX-8350 Eight-Core CPU, ZALMAN CNPS10X Performa CPU cooler,
G.SKILL 32GB DDR3 PC3 12800 Memory Nvidia GTX-650 video card LG W2253 Monitor
9TBs of hard drive space using LVM
Cooler Master HAF-932 Case
Back to top
View user's profile Send private message
moocha
Watchman
Watchman


Joined: 21 Oct 2003
Posts: 5722

PostPosted: Fri May 21, 2004 1:33 pm    Post subject: Reply with quote

In fact nobody should ever use the -mmmx, -msse etc etc flags. Just set -march and -mcpu (both, in case an ebuild filters -march out, then at leats you'll have -mcpu left) and let the compiler decide on the -m flags. It will usually make a better decision than you. Assuming you have at least GCC 3.3, of course.
-Os is useful for very old processors, without level 2 cache (or with a very small level 2 cache), and for SMP systems. For normal desktop usage it's slower than -O2 or -O3, and in most cases slower than -O1.
Avoid specifying -mfpmath. -mfpmath=sse always produces horrible code. -mfpmath=sse,387 produces marginally better but quite slow code (GCC's floating point optimizer can't yet make good use of a dual set of registers, SSE and the FP ones). Stick with -mfpmath=387, which is the default. In other words, don't fiddle with -mfpmath unless you're running the latest, bleeding edge CVS version of GCC (and if you do that you don't need anyone to tell you what to use :D)
Do NOT use -ffast-math. You're asking for it.
To summarize: Other than -march and -mcpu, stay away from the -m switches unless you know *exactly* what you're doing. Very few packages benefit from messing with them, and the corresponding ebuilds and/or configure scripts take care of them in those cases. You can fiddle with the -m flags, of course, but you'll usually end up with slower running code than if you'd just gone with the defaults.
_________________
Military Commissions Act of 2006: http://tinyurl.com/jrcto

"Those who would give up essential liberty to purchase a little temporary safety deserve neither liberty nor safety."
-- attributed to Benjamin Franklin
Back to top
View user's profile Send private message
vdboor
Guru
Guru


Joined: 03 Dec 2003
Posts: 592
Location: The Netherlands

PostPosted: Fri May 21, 2004 2:52 pm    Post subject: Reply with quote

moocha wrote:
In fact nobody should ever use the -mmmx, -msse etc etc flags. Just set -march and -mcpu (both, in case an ebuild filters -march out, then at leats you'll have -mcpu left) and let the compiler decide on the -m flags. It will usually make a better decision than you. Assuming you have at least GCC 3.3, of course.
-Os is useful for very old processors, without level 2 cache (or with a very small level 2 cache), and for SMP systems. For normal desktop usage it's slower than -O2 or -O3, and in most cases slower than -O1.
Avoid specifying -mfpmath. -mfpmath=sse always produces horrible code. -mfpmath=sse,387 produces marginally better but quite slow code (GCC's floating point optimizer can't yet make good use of a dual set of registers, SSE and the FP ones). Stick with -mfpmath=387, which is the default. In other words, don't fiddle with -mfpmath unless you're running the latest, bleeding edge CVS version of GCC (and if you do that you don't need anyone to tell you what to use :D)
Do NOT use -ffast-math. You're asking for it.
To summarize: Other than -march and -mcpu, stay away from the -m switches unless you know *exactly* what you're doing. Very few packages benefit from messing with them, and the corresponding ebuilds and/or configure scripts take care of them in those cases. You can fiddle with the -m flags, of course, but you'll usually end up with slower running code than if you'd just gone with the defaults.


Thanks for this useful info :) I think this should be at the main page somewhere, because everyone seams to play _a lot_ with their flags.. Also, -fomit-framepointer and such are already used for -O2 ;)
My CFLAGS seam to get cleaner and shorter each month :P
_________________
The best way to accelerate a windows server is by 9.81M/S²
Linux user #311670 and Yet Another Perl Programmer

[ screenies | Coding on KMess ]
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum