Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
I am confused... What's better:-march=i686 or -mcpu=i686?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
planetsheinker
Guru
Guru


Joined: 26 Feb 2004
Posts: 403
Location: Israel

PostPosted: Thu Dec 30, 2004 2:07 pm    Post subject: I am confused... What's better:-march=i686 or -mcpu=i686? Reply with quote

I am confused... What's better:
-march=i686 or -mcpu=i686?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54928
Location: 56N 3W

PostPosted: Thu Dec 30, 2004 2:20 pm    Post subject: Reply with quote

planetsheinker,

Code:
man gcc
says
Code:
       -march=cpu-type
           Generate instructions for the machine type cpu-type.  The choices
           for cpu-type are the same as for -mtune.  Moreover, specifying
           -march=cpu-type implies -mtune=cpu-type.

       -mcpu=cpu-type
           A deprecated synonym for -mtune.


-march=cpu-type may produce code that will not run on earlier processors.
-mcpu=cpu-type and -mtune=cpu-type optimise for the selected CPU without destrying backwards compatabity.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
planetsheinker
Guru
Guru


Joined: 26 Feb 2004
Posts: 403
Location: Israel

PostPosted: Thu Dec 30, 2004 2:50 pm    Post subject: Reply with quote

NeddySeagoon wrote:
planetsheinker,

Code:
man gcc
says
Code:
       -march=cpu-type
           Generate instructions for the machine type cpu-type.  The choices
           for cpu-type are the same as for -mtune.  Moreover, specifying
           -march=cpu-type implies -mtune=cpu-type.

       -mcpu=cpu-type
           A deprecated synonym for -mtune.


-march=cpu-type may produce code that will not run on earlier processors.
-mcpu=cpu-type and -mtune=cpu-type optimise for the selected CPU without destrying backwards compatabity.

Thanks,
let me see if I got that right: so -march=cpu-type will result in a faster binarys (i dont care that it brakes compatability with older cpu)?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54928
Location: 56N 3W

PostPosted: Thu Dec 30, 2004 3:00 pm    Post subject: Reply with quote

planetsheinker.

-march=cpu-type *may* result in faster binaries.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
planetsheinker
Guru
Guru


Joined: 26 Feb 2004
Posts: 403
Location: Israel

PostPosted: Thu Dec 30, 2004 3:50 pm    Post subject: Reply with quote

NeddySeagoon wrote:
planetsheinker.

-march=cpu-type *may* result in faster binaries.

Why do you say *may*?
As far as I understand, it will defenetly result in a faster system, cuz' the code is compiled with
your CPU in mind. Correct me if I am wrong, yes?
Back to top
View user's profile Send private message
hjnenc
Veteran
Veteran


Joined: 15 Aug 2004
Posts: 1599
Location: Vienna, Austria

PostPosted: Thu Dec 30, 2004 5:24 pm    Post subject: Reply with quote

The average program will run faster but there may be also programs that actually run slower. Keep in mind that most optimizations are based on assumptions of typical program behaviour.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54928
Location: 56N 3W

PostPosted: Thu Dec 30, 2004 7:43 pm    Post subject: Reply with quote

planetsheinker,

What hjnenc says is quite valid but what I had in mind was that not all programs will use the new instructions on later CPUs anyway.

It is quite possible that you can use
Code:
 -march=pentium7 [1]
and still find your program runs on a 386. It will vary from program to program.

[1] I know there is no pentium7 yet.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming 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