Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Optimum CFLAGs for 32bit environment on amd64
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Duplicate Threads
View previous topic :: View next topic  
Author Message
kamisama
n00b
n00b


Joined: 27 Apr 2004
Posts: 41

PostPosted: Wed Mar 09, 2005 2:55 pm    Post subject: Optimum CFLAGs for 32bit environment on amd64 Reply with quote

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
View user's profile Send private message
andrew_j_w
Guru
Guru


Joined: 28 Jun 2003
Posts: 534
Location: York, UK

PostPosted: Wed Mar 09, 2005 3:02 pm    Post subject: Reply with quote

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
View user's profile Send private message
kamisama
n00b
n00b


Joined: 27 Apr 2004
Posts: 41

PostPosted: Wed Mar 09, 2005 3:22 pm    Post subject: that Reply with quote

that would explain quite a few weird things that were happening.. laugh
Back to top
View user's profile Send private message
Birtz
Apprentice
Apprentice


Joined: 09 Feb 2005
Posts: 272
Location: Osijek / Croatia

PostPosted: Wed Mar 09, 2005 3:52 pm    Post subject: Reply with quote

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
View user's profile Send private message
stefanwa
Tux's lil' helper
Tux's lil' helper


Joined: 09 Dec 2002
Posts: 140

PostPosted: Wed Mar 09, 2005 5:04 pm    Post subject: Reply with quote

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
View user's profile Send private message
andrew_j_w
Guru
Guru


Joined: 28 Jun 2003
Posts: 534
Location: York, UK

PostPosted: Wed Mar 09, 2005 5:52 pm    Post subject: Reply with quote

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! :lol:

Andrew
Back to top
View user's profile Send private message
Birtz
Apprentice
Apprentice


Joined: 09 Feb 2005
Posts: 272
Location: Osijek / Croatia

PostPosted: Wed Mar 09, 2005 5:58 pm    Post subject: Reply with quote

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
View user's profile Send private message
Birtz
Apprentice
Apprentice


Joined: 09 Feb 2005
Posts: 272
Location: Osijek / Croatia

PostPosted: Wed Mar 09, 2005 6:04 pm    Post subject: Reply with quote

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! :lol:


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 8)

You are right about -msse2 implication by arch keyword though :wink: :D

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
View user's profile Send private message
Maedhros
Bodhisattva
Bodhisattva


Joined: 14 Apr 2004
Posts: 5511
Location: Durham, UK

PostPosted: Wed Mar 09, 2005 7:20 pm    Post subject: Reply with quote

Please follow up to this thread: https://forums.gentoo.org/viewtopic-t-177670.html

Moved from Gentoo on AMD64.
_________________
No-one's more important than the earthworm.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Duplicate Threads 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