Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
cflags on 1ghz tibook
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on PPC
View previous topic :: View next topic  
Author Message
nss
Guru
Guru


Joined: 04 Oct 2004
Posts: 389

PostPosted: Thu Dec 02, 2004 7:53 pm    Post subject: cflags on 1ghz tibook Reply with quote

discuss cflags on this machine...

is -O3 a safe stable option?
_________________
gentoo good to be true
Back to top
View user's profile Send private message
fafhrd
Retired Dev
Retired Dev


Joined: 14 May 2002
Posts: 431
Location: Williamstown, MA

PostPosted: Fri Dec 03, 2004 12:59 am    Post subject: Reply with quote

In my opinion, although likely others will disagree, -O3 turns on so many debugging killing options that it's not worth it off the bat. However, even if you're okay with that, it turns on options that may actually slow your computer down.

If you post the output of your /proc/cpuinfo (which specifies the type of chip you have exactly) I can offer some more suggestions on ideal base flags, that you can then customize to your liking.

In ppc, the example make.conf provides entries for CFLAGS that are quite redundant, especially for "G4" chips, like yours.
_________________
jñanam bandha
Back to top
View user's profile Send private message
nss
Guru
Guru


Joined: 04 Oct 2004
Posts: 389

PostPosted: Sat Dec 04, 2004 10:47 pm    Post subject: Reply with quote

processor : 0
cpu : 7455, altivec supported
clock : 1000MHz
revision : 3.3 (pvr 8001 0303)
bogomips : 665.60

total bogomips :665.60
machine : Powerbook3,5
motherboard : Powerbook3,5 MacRISC2 MacRISC Power Macintosh
detected as : 80 (PowerBook Titanium IV)
pmac flags : 0000000b
L2 cache : 256K unified
memory : 1024MB
pmac-generation : NewWorld
_________________
gentoo good to be true
Back to top
View user's profile Send private message
fafhrd
Retired Dev
Retired Dev


Joined: 14 May 2002
Posts: 431
Location: Williamstown, MA

PostPosted: Sat Dec 04, 2004 11:22 pm    Post subject: Reply with quote

I would start with base flags like this:
Code:
-mcpu=G4
G4 is basically "-mcpu=7400 -maltivec" ... however, there is a "7450" designation as well; it's important to know it exists, and likely would be more appropriate, but -mcpu=7450 is pretty much been broken for everyone (seemingly random compiles break, etc), so I would stick with "-mcpu=G4".

There is also a "-mtune" option, but it's only going to be useful if you want to optimize the scheduling independant of the other -mcpu factors (-mcpu does set the scheduling too, -mtune will override it). I can see this being useful if you have a handful of PowerPC machine, maybe most are servers, or just sit around, but some people have new flashy G4 laptops, and want a good amount of speed from them. However, you don't want to provide binaries for every single platform, so you could do something like "-mcpu=powerpc -mtune=G4" -- NOTE: I haven't used this, and I really never plan to, so not even YMMV, but Your Mileage WILL Vary. :-)

If you want something simple:
Code:
-mcpu=G4 -O2 -pipe
...is a good start. In my tests so far, -O3 turns on options that actually slow down many things ... not to mention that many of it's options completely destroy any chance of debugging code, at all -- this is not an option for me.

Another thing to consider is "-mabi=altivec"; I've noticed so far that this option slightly lengthens compile time (really, slightly: it could just be the parsing of that option itself!), and, generally, allows that abi to utilize altivec (note that this is different from the -maltivec enough, which you already have by default with -mcpu=G4). I would use it, but this one is up to you. I don't like to monkey with ABI stuff too much -- however, changing this one does not seem to be fatal, as it allows the extensions to be used, not necessarily required (so it seems to me so far, but I'm not done researching this yet).

So far we have this:
Code:
-O2 -pipe -mcpu=G4 -mabi=altivec
...I would say let this be your starting point. Avoid adding other -m options in unless you know exactly the ramifications of what they mean, or if you're "just testing" feel free ;-)

You can review the documentation (e.g. using gcc-3.4.3) here: http://gcc.gnu.org/onlinedocs/gcc-3.4.3/gcc/;
specially here: http://gcc.gnu.org/onlinedocs/gcc-3.4.3/gcc/RS_002f6000-and-PowerPC-Options.html#RS_002f6000-and-PowerPC-Options for POWER/PowerPC options overview
and here: http://gcc.gnu.org/onlinedocs/gcc-3.4.3/gcc/Optimize-Options.html#Optimize-Options for options that control general optimization.

I cannot stress enough: Don't turn something on or off unless you know what it does or trust the person who's telling you to do so...so that means don't trust me either. :-) Read the docs and see if what I'm saying makes sense to you.

In practice, if you start at -O2, you can use "-fno-opt-name" to turn off options that -O1 and -O2 turn on by default (generally), and the the normal "-fopt-name" to turn on other options.

To illustrate, here are my cflags, which I'm currently using. I try to not change them often (if ever, actually), and these have been working great for me so far. Likely, one day, some benchmarks or real world applications will prove me very wrong about these, but generally I'm happy with them. Like I said, I'm still researching all this, so these are not garaunteed to work for you as well as they do for me.

Code:
CFLAGS="-O1 -pipe -mcpu=G4 -mabi=altivec -malign-natural -ftracer -fsched-spec -fstrength-reduce -frerun-loop-opt -falign-loops -fpeel-loops -fno-delayed-branch -fschedule-insns -freduce-all-givs -fcse-follow-jumps -fexpensive-optimizations"


I've tested these with benchmarks, acovea (sort of a benchmark :-)), and real world apps like GIMP and mplayer and transcode. I am happy with them. I can only with more apps had altivec support! ;-)

My system's /proc/cpuinfo is this:
Code:
processor       : 0
cpu             : 7447A, altivec supported
clock           : 1499MHz
revision        : 1.1 (pvr 8003 0101)
bogomips        : 1495.04
machine         : PowerBook5,4
motherboard     : PowerBook5,4 MacRISC3 Power Macintosh
detected as     : 287 (PowerBook G4 15")
pmac flags      : 0000001b
L2 cache        : 512K unified
memory          : 512MB
pmac-generation : NewWorld


Note: I've told some people that I'm hoping to finish up something I'm writing about PowerPC GCC opts....hopefully this is just a colloquialized summary, not to be seen as a sample. :-)
_________________
jñanam bandha
Back to top
View user's profile Send private message
_savage
Guru
Guru


Joined: 06 Jun 2004
Posts: 308
Location: Redmond, WA

PostPosted: Sun Dec 05, 2004 3:47 pm    Post subject: Reply with quote

The -mcpu=G4 flag does not work for gcc below 3.4 so be careful with that. I run Gentoo on a 1G TiBook with the following options:

Code:
CFLAGS="-O2 -mcpu=7450 -mtune=7450 -maltivec -mabi=altivec -pipe -fomit-frame-pointer -fno-strict-aliasing"
CXXFLAGS="${CFLAGS}"


My system runs fine and stable, no quirks as far as I can tell. (Except I screw it up myself :-) )

Cheers,
Jens
_________________
Jens Troeger
http://savage.light-speed.de/
Back to top
View user's profile Send private message
fafhrd
Retired Dev
Retired Dev


Joined: 14 May 2002
Posts: 431
Location: Williamstown, MA

PostPosted: Sun Dec 05, 2004 6:55 pm    Post subject: Reply with quote

As for the "-mcpu=7450" breaking stuff, "It's been reported by many" and "it's happened to me" ... it doesn't mean it's going to happen to you (personally, I'd like to know what makes things go bad)...but anyways:

Code:
-mcpu=7450 -mtune=7450

... this is redundant

Code:
-mcpu=7450 -maltivec

... this is redundant

If you tell me what version of GCC you have, I can point you to source code lines that explain how redundant specifiying those two options with -mcpu=7450 is.
_________________
jñanam bandha
Back to top
View user's profile Send private message
nss
Guru
Guru


Joined: 04 Oct 2004
Posts: 389

PostPosted: Mon Dec 06, 2004 8:51 am    Post subject: Reply with quote

any other tibooks out there?

JD, how are you doing?
_________________
gentoo good to be true
Back to top
View user's profile Send private message
_savage
Guru
Guru


Joined: 06 Jun 2004
Posts: 308
Location: Redmond, WA

PostPosted: Mon Dec 06, 2004 9:23 am    Post subject: Reply with quote

fafhrd wrote:
If you tell me what version of GCC you have, I can point you to source code lines that explain how redundant specifiying those two options with -mcpu=7450 is.


To use with make.conf I switch between 3.3 and 3.4 (don't like to compile glibc with 3.4 it's been breaking things on other machines). I also use 2.95 to compile some old stuff by hand, but that's secondary.

Cheers,
Jens
_________________
Jens Troeger
http://savage.light-speed.de/
Back to top
View user's profile Send private message
fafhrd
Retired Dev
Retired Dev


Joined: 14 May 2002
Posts: 431
Location: Williamstown, MA

PostPosted: Mon Dec 06, 2004 7:10 pm    Post subject: Reply with quote

Oh, heh, I'm not looking at gcc-2.95 at all for this thing that I'm doing, however for gcc-3.3.4, I can tell you this:

- gcc-3.3.4: yes, you're right -maltivec is not on by default for -m7400 or -m7450 -- I should've made the version of gcc I was testing with more clear! Sorry :-\

- gcc-3.4.x: my conclusions remain the same.

Sorry for any confusion.

This is definitely important too, for those that may be installiing fresh are likely not using gcc-3.4.X. I recently rebuilt my 'world' with gcc-3.4.3, however, and everything went fine. Most of my research into was with gcc-3.4.X, and gcc-3.3.X only cursorily. I hope this clears up the confusion.
_________________
jñanam bandha
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on PPC All times are GMT
Page 1 of 1

 
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