View previous topic :: View next topic |
Author |
Message |
kamisama n00b
Joined: 27 Apr 2004 Posts: 41
|
Posted: Wed Mar 09, 2005 2:55 pm Post subject: Optimum CFLAGs for 32bit environment on amd64 |
|
|
CHOST="i686 etc"
CFLAGS="-march=athlon64 -pipe -O3"
This is what I plan to use, are there any problems with using march=athlon64 when compiling a 32 bit environment?
I want it to be optimized as much as possible for my amd64, but I don't want to take the step into running it 64bit yet |
|
Back to top |
|
|
andrew_j_w Guru
Joined: 28 Jun 2003 Posts: 534 Location: York, UK
|
Posted: Wed Mar 09, 2005 3:02 pm Post subject: |
|
|
Um, setting arch=athlon64 will make gcc produce 64 bit code.
If you really want to compile 32 bit code set it to an Athlon-xp.
HTH,
Andrew |
|
Back to top |
|
|
kamisama n00b
Joined: 27 Apr 2004 Posts: 41
|
Posted: Wed Mar 09, 2005 3:22 pm Post subject: that |
|
|
that would explain quite a few weird things that were happening.. laugh |
|
Back to top |
|
|
Birtz Apprentice
Joined: 09 Feb 2005 Posts: 272 Location: Osijek / Croatia
|
Posted: Wed Mar 09, 2005 3:52 pm Post subject: |
|
|
andrew_j_w wrote: | Um, setting arch=athlon64 will make gcc produce 64 bit code.
|
Wrong, this arch setting on 32-bit system wouldn't produce 64-bit code because compiler has no 64-bit capabilities anyway. Note that he is talking about a pure x86 environment.
I would recommend;
Code: | CFLAGS="-pipe -O2 -march=athlon64 -fomit-frame-pointer" |
Cheers _________________ It is not enough to have a good mind. The main thing is to use it well.
-- Rene Descartes
Don't have a childhood hero? How about Rob Hubbard http://www.freenetpages.co.uk/hp/tcworh/profile.htm |
|
Back to top |
|
|
stefanwa Tux's lil' helper
Joined: 09 Dec 2002 Posts: 140
|
Posted: Wed Mar 09, 2005 5:04 pm Post subject: |
|
|
I've seen people using "-msse2". Is it necessary or is sse2 automatically used when using "-march=athlon64" with gcc-3.4.3? |
|
Back to top |
|
|
andrew_j_w Guru
Joined: 28 Jun 2003 Posts: 534 Location: York, UK
|
Posted: Wed Mar 09, 2005 5:52 pm Post subject: |
|
|
Birtz wrote: | andrew_j_w wrote: | Um, setting arch=athlon64 will make gcc produce 64 bit code.
|
Wrong, this arch setting on 32-bit system wouldn't produce 64-bit code because compiler has no 64-bit capabilities anyway. Note that he is talking about a pure x86 environment.
|
Ooh, you're right. I have just checked the gcc docs and a straight 32 bit gcc won't have the -m64 option which enables 64 bit compiles. Sorry for spreading misinformation!
-msse2 is implied by -march=athlon64 so you shouldn't need it... but going on my previous contribution to this thread you might want someone else to confirm that!
Andrew |
|
Back to top |
|
|
Birtz Apprentice
Joined: 09 Feb 2005 Posts: 272 Location: Osijek / Croatia
|
Posted: Wed Mar 09, 2005 5:58 pm Post subject: |
|
|
stefanwa wrote: | I've seen people using "-msse2". Is it necessary or is sse2 automatically used when using "-march=athlon64" with gcc-3.4.3? |
In 32-bit only environment (no multilib capable gcc/glibc), which is default for x86 Gentoo this
Code: | CHOST="i686-pc-linux-gnu"
CFLAGS="-pipe -O2 -march=athlon64 -fomit-frame-pointer" |
would produce 32-bit code optimized for athlon64/opteron *including* flags -msse -msse2 -m3dnow -mmmx
Take note also that >=GCC-3.4.3 is not default compiler for stable branch of x86, so this flags are unusable with GCC-3.3.5 which is default compiler.
To make use of the flags I gave make sure you have ~x86 in you package.keywords file for gcc;
Code: | # cat /etc/portage/package.keywords
sys-devel/gcc ~x86 |
Cheers _________________ It is not enough to have a good mind. The main thing is to use it well.
-- Rene Descartes
Don't have a childhood hero? How about Rob Hubbard http://www.freenetpages.co.uk/hp/tcworh/profile.htm |
|
Back to top |
|
|
Birtz Apprentice
Joined: 09 Feb 2005 Posts: 272 Location: Osijek / Croatia
|
Posted: Wed Mar 09, 2005 6:04 pm Post subject: |
|
|
andrew_j_w wrote: |
-msse2 is implied by -march=athlon64 so you shouldn't need it... but going on my previous contribution to this thread you might want someone else to confirm that!
|
I've just finished athlon64 optimized x86 installation in the VmWare, so I knew that 64/32-bit compiler stuff from the top of my head
You are right about -msse2 implication by arch keyword though
Cheers _________________ It is not enough to have a good mind. The main thing is to use it well.
-- Rene Descartes
Don't have a childhood hero? How about Rob Hubbard http://www.freenetpages.co.uk/hp/tcworh/profile.htm |
|
Back to top |
|
|
Maedhros Bodhisattva
Joined: 14 Apr 2004 Posts: 5511 Location: Durham, UK
|
|
Back to top |
|
|
|