public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/45483]  New: gcc-4.4.3: probably wrong optimization options chosen by "-march=native"
@ 2010-09-01 15:04 pacho at condmat1 dot ciencias dot uniovi dot es
  2010-09-01 15:40 ` [Bug c/45483] " hjl dot tools at gmail dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: pacho at condmat1 dot ciencias dot uniovi dot es @ 2010-09-01 15:04 UTC (permalink / raw)
  To: gcc-bugs

I checked what options are being chosen on one of my laptops following the
following instructions:
http://en.chys.info/2010/04/what-exactly-marchnative-means/

But,  when reviewing used options I got:

$ ps af | grep cc1
18118 pts/1    S+     0:00  \_ grep --colour=auto cc1
18116 pts/0    S+     0:00      \_ /usr/libexec/gcc/i686-pc-linux-gnu/4.4.3/cc1
-quiet - -D_FORTIFY_SOURCE=2 -march=prescott --param l1-cache-size=32 --param
l1-cache-line-size=64 --param l2-cache-size=2048 -mtune=generic -quiet
-dumpbase - -auxbase-strip /dev/null -o /tmp/ccLS5xw5.s
13580 tty3     S+     0:00          \_
/usr/libexec/gcc/i686-pc-linux-gnu/4.4.3/cc1 -quiet - -D_FORTIFY_SOURCE=2
-march=prescott --param l1-cache-size=32 --param l1-cache-line-size=64 --param
l2-cache-size=2048 -mtune=generic -quiet -dumpbase - -auxbase-strip /dev/null
-o /tmp/ccSnTxP2.s

My /proc/cpuinfo is the following:

$ cat /proc/cpuinfo 
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 14
model name      : Genuine Intel(R) CPU           T2300  @ 1.66GHz
stepping        : 8
cpu MHz         : 996.000
cache size      : 2048 KB
physical id     : 0
siblings        : 2
core id         : 0
cpu cores       : 2
apicid          : 0
initial apicid  : 0
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 10
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx constant_tsc arch_perfmon
bts aperfmperf pni monitor vmx est tm2 xtpr pdcm
bogomips        : 3324.55
clflush size    : 64
cache_alignment : 64
address sizes   : 32 bits physical, 32 bits virtual
power management:

processor       : 1
vendor_id       : GenuineIntel
cpu family      : 6
model           : 14
model name      : Genuine Intel(R) CPU           T2300  @ 1.66GHz
stepping        : 8
cpu MHz         : 996.000
cache size      : 2048 KB
physical id     : 0
siblings        : 2
core id         : 1
cpu cores       : 2
apicid          : 1
initial apicid  : 1
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 10
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx constant_tsc arch_perfmon
bts aperfmperf pni monitor vmx est tm2 xtpr pdcm
bogomips        : 3324.56
clflush size    : 64
cache_alignment : 64
address sizes   : 32 bits physical, 32 bits virtual
power management:

And, then, I see two problems:
1. -mtune=generic is being passed instead of, for example, -mtune="specific
option"

As I can read in "man gcc", looks like code is really being compiled for a
generic set of CPUs instead of specific one:

           generic
               Produce code optimized for the most common IA32/AMD64/EM64T
processors.  If you know the CPU on which your code will run, then
               you should use the corresponding -mtune option instead of
-mtune=generic.  But, if you do not know exactly what CPU users of
               your application will have, then you should use this option.

               As new processors are deployed in the marketplace, the behavior
of this option will change.  Therefore, if you upgrade to a
               newer version of GCC, the code generated option will change to
reflect the processors that were most common when that version
               of GCC was released.

               There is no -march=generic option because -march indicates the
instruction set the compiler can use, and there is no generic
               instruction set applicable to all processors.  In contrast,
-mtune indicates the processor (or, in this case, collection of
               processors) for which the code is optimized.

2. -march=prescott 

I am unsure about my processor is really a prescott one, even supporting sse3
it's listed as a Pentium-M based processor in the following links:
http://en.wikipedia.org/wiki/List_of_Intel_microprocessors#Intel_Core
http://en.wikipedia.org/wiki/Yonah_(microprocessor)
http://en.wikipedia.org/wiki/List_of_Intel_Core_microprocessors#Core_Duo

Then, I would pass "-march=pentium-m -msse3" instead.

Thanks a lot for your help


-- 
           Summary: gcc-4.4.3: probably wrong optimization options chosen by
                    "-march=native"
           Product: gcc
           Version: 4.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pacho at condmat1 dot ciencias dot uniovi dot es


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45483


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c/45483] gcc-4.4.3: probably wrong optimization options chosen by "-march=native"
  2010-09-01 15:04 [Bug c/45483] New: gcc-4.4.3: probably wrong optimization options chosen by "-march=native" pacho at condmat1 dot ciencias dot uniovi dot es
@ 2010-09-01 15:40 ` hjl dot tools at gmail dot com
  2010-09-01 15:51 ` pacho at condmat1 dot ciencias dot uniovi dot es
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-09-01 15:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from hjl dot tools at gmail dot com  2010-09-01 15:40 -------
Please try gcc 4.5.2 and report what it does.


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hjl dot tools at gmail dot
                   |                            |com
             Status|UNCONFIRMED                 |WAITING


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45483


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c/45483] gcc-4.4.3: probably wrong optimization options chosen by "-march=native"
  2010-09-01 15:04 [Bug c/45483] New: gcc-4.4.3: probably wrong optimization options chosen by "-march=native" pacho at condmat1 dot ciencias dot uniovi dot es
  2010-09-01 15:40 ` [Bug c/45483] " hjl dot tools at gmail dot com
@ 2010-09-01 15:51 ` pacho at condmat1 dot ciencias dot uniovi dot es
  2010-09-01 15:56 ` [Bug target/45483] " hjl dot tools at gmail dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pacho at condmat1 dot ciencias dot uniovi dot es @ 2010-09-01 15:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pacho at condmat1 dot ciencias dot uniovi dot es  2010-09-01 15:51 -------
gcc-4.5 is still hardmasked downstream in Gentoo, then, I am unsure about
installing it :-/, are you sure this bug could be solved in 4.5* ?


-- 

pacho at condmat1 dot ciencias dot uniovi dot es changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|target                      |c


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45483


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/45483] gcc-4.4.3: probably wrong optimization options chosen by "-march=native"
  2010-09-01 15:04 [Bug c/45483] New: gcc-4.4.3: probably wrong optimization options chosen by "-march=native" pacho at condmat1 dot ciencias dot uniovi dot es
  2010-09-01 15:40 ` [Bug c/45483] " hjl dot tools at gmail dot com
  2010-09-01 15:51 ` pacho at condmat1 dot ciencias dot uniovi dot es
@ 2010-09-01 15:56 ` hjl dot tools at gmail dot com
  2010-09-01 16:06 ` pacho at condmat1 dot ciencias dot uniovi dot es
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-09-01 15:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from hjl dot tools at gmail dot com  2010-09-01 15:56 -------
(In reply to comment #2)
> gcc-4.5 is still hardmasked downstream in Gentoo, then, I am unsure about
> installing it :-/, are you sure this bug could be solved in 4.5* ?
> 

1. -march=native is changed in gcc 4.5.
2. Your cpu is Core.
3. -mtune=generic generates the fastest code for Core.
4. Prescott and Core have the same instruction set.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45483


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/45483] gcc-4.4.3: probably wrong optimization options chosen by "-march=native"
  2010-09-01 15:04 [Bug c/45483] New: gcc-4.4.3: probably wrong optimization options chosen by "-march=native" pacho at condmat1 dot ciencias dot uniovi dot es
                   ` (2 preceding siblings ...)
  2010-09-01 15:56 ` [Bug target/45483] " hjl dot tools at gmail dot com
@ 2010-09-01 16:06 ` pacho at condmat1 dot ciencias dot uniovi dot es
  2010-09-01 16:37 ` hjl dot tools at gmail dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pacho at condmat1 dot ciencias dot uniovi dot es @ 2010-09-01 16:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pacho at condmat1 dot ciencias dot uniovi dot es  2010-09-01 16:06 -------
(In reply to comment #3)
> (In reply to comment #2)
> > gcc-4.5 is still hardmasked downstream in Gentoo, then, I am unsure about
> > installing it :-/, are you sure this bug could be solved in 4.5* ?
> > 
> 
> 1. -march=native is changed in gcc 4.5.

Will try then with 4.5.1 (4.5.2 is still not available on Gentoo)

> 2. Your cpu is Core.
> 3. -mtune=generic generates the fastest code for Core.
> 4. Prescott and Core have the same instruction set.

Is -mtune=generic better than -mtune=prescott? "man gcc" looks to suggest last
one would be better:
If you know the CPU on which your code will run, then you should use the
corresponding -mtune option instead of -mtune=generic.



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45483


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/45483] gcc-4.4.3: probably wrong optimization options chosen by "-march=native"
  2010-09-01 15:04 [Bug c/45483] New: gcc-4.4.3: probably wrong optimization options chosen by "-march=native" pacho at condmat1 dot ciencias dot uniovi dot es
                   ` (3 preceding siblings ...)
  2010-09-01 16:06 ` pacho at condmat1 dot ciencias dot uniovi dot es
@ 2010-09-01 16:37 ` hjl dot tools at gmail dot com
  2010-09-06 10:45 ` pacho at condmat1 dot ciencias dot uniovi dot es
  2010-09-06 15:09 ` hjl dot tools at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-09-01 16:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from hjl dot tools at gmail dot com  2010-09-01 16:37 -------
(In reply to comment #4)
> (In reply to comment #3)
> > (In reply to comment #2)
> > > gcc-4.5 is still hardmasked downstream in Gentoo, then, I am unsure about
> > > installing it :-/, are you sure this bug could be solved in 4.5* ?
> > > 
> > 
> > 1. -march=native is changed in gcc 4.5.
> 
> Will try then with 4.5.1 (4.5.2 is still not available on Gentoo)
> 
> > 2. Your cpu is Core.
> > 3. -mtune=generic generates the fastest code for Core.
> > 4. Prescott and Core have the same instruction set.
> 
> Is -mtune=generic better than -mtune=prescott? "man gcc" looks to suggest last
> one would be better:
> If you know the CPU on which your code will run, then you should use the
> corresponding -mtune option instead of -mtune=generic.
> 
> 

-mtune=generic is the best tuning option for Intel processors,
regardless whatever gcc manual says.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45483


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/45483] gcc-4.4.3: probably wrong optimization options chosen by "-march=native"
  2010-09-01 15:04 [Bug c/45483] New: gcc-4.4.3: probably wrong optimization options chosen by "-march=native" pacho at condmat1 dot ciencias dot uniovi dot es
                   ` (4 preceding siblings ...)
  2010-09-01 16:37 ` hjl dot tools at gmail dot com
@ 2010-09-06 10:45 ` pacho at condmat1 dot ciencias dot uniovi dot es
  2010-09-06 15:09 ` hjl dot tools at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: pacho at condmat1 dot ciencias dot uniovi dot es @ 2010-09-06 10:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pacho at condmat1 dot ciencias dot uniovi dot es  2010-09-06 10:45 -------
This is what I get with gcc-4.5.1:
root       651  0.0  0.1  13080  1780 tty1     S+   19:18   0:00
usr/libexec/gcc/i686-pc-linux-gnu/4.5.1/cc1 -quiet - -D_FORTIFY_SOURCE=2
 -march=pentium-m --param l1-cache-size=32 --param l1-cache-line-size=64
 - --param l2-cache-size=2048 -mtune=generic -quiet -dumpbase -
 - -- -auxbase-strip /dev/null -o /tmp/cc3udN3F.s

Then, looks like:
1. It's still using -mtune=generic
2. It now uses "-march=pentium-m" instead of "presscott" :-/
3. It doesn't seem to detect "sse3" 

Thanks for your help :-)


-- 

pacho at condmat1 dot ciencias dot uniovi dot es changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |UNCONFIRMED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45483


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/45483] gcc-4.4.3: probably wrong optimization options chosen by "-march=native"
  2010-09-01 15:04 [Bug c/45483] New: gcc-4.4.3: probably wrong optimization options chosen by "-march=native" pacho at condmat1 dot ciencias dot uniovi dot es
                   ` (5 preceding siblings ...)
  2010-09-06 10:45 ` pacho at condmat1 dot ciencias dot uniovi dot es
@ 2010-09-06 15:09 ` hjl dot tools at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-09-06 15:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from hjl dot tools at gmail dot com  2010-09-06 15:08 -------
A patch is posted at

http://gcc.gnu.org/ml/gcc-patches/2010-09/msg00469.html


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ubizjak at gmail dot com
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2010-
                   |                            |09/msg00469.html
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-09-06 15:08:27
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45483


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-09-06 15:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-01 15:04 [Bug c/45483] New: gcc-4.4.3: probably wrong optimization options chosen by "-march=native" pacho at condmat1 dot ciencias dot uniovi dot es
2010-09-01 15:40 ` [Bug c/45483] " hjl dot tools at gmail dot com
2010-09-01 15:51 ` pacho at condmat1 dot ciencias dot uniovi dot es
2010-09-01 15:56 ` [Bug target/45483] " hjl dot tools at gmail dot com
2010-09-01 16:06 ` pacho at condmat1 dot ciencias dot uniovi dot es
2010-09-01 16:37 ` hjl dot tools at gmail dot com
2010-09-06 10:45 ` pacho at condmat1 dot ciencias dot uniovi dot es
2010-09-06 15:09 ` hjl dot tools at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).