Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
"gcc -march=<moocow> -Q --help=target -v" faulty?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Cyker
Veteran
Veteran


Joined: 15 Jun 2006
Posts: 1746

PostPosted: Thu Jul 24, 2014 7:58 am    Post subject: "gcc -march=<moocow> -Q --help=target -v" fa Reply with quote

While participating in another thread, I've noticed that
Code:
gcc -Q --help=target -v
doesn't seem to be working properly.

I currently have sys-devel/gcc-4.7.3-r1:4.7 installed

Can you guys check yours briefly just so I can see if it's a problem on my system or with gcc?

The two below should be fairly similar but are not:

gcc -march=native -Q --help=target -v:

Using built-in specs.
COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/4.7.3/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.7.3/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-4.7.3-r1/work/gcc-4.7.3/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.7.3 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.3 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.3/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.3/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/include/g++-v4 --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.7.3/python --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.7.3-r1 p1.4, pie-0.5.5' --enable-libstdcxx-time --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib --with-multilib-list=m32,m64 --disable-altivec --disable-fixed-point --enable-targets=all --disable-libgcj --enable-libgomp --disable-libmudflap --disable-libssp --enable-lto --without-cloog --without-ppl
Thread model: posix
gcc version 4.7.3 (Gentoo 4.7.3-r1 p1.4, pie-0.5.5)
COLLECT_GCC_OPTIONS='-march=native' '-Q' '--help=target' '-v'
 /usr/libexec/gcc/x86_64-pc-linux-gnu/4.7.3/cc1 -v help-dummy -march=bdver2 -mcx16 -msahf -mno-movbe -maes -mpclmul -mpopcnt -mabm -mlwp -mfma -mfma4 -mxop -mbmi -mno-bmi2 -mtbm -mavx -mno-avx2 -msse4.2 -msse4.1 -mlzcnt -mno-rdrnd -mf16c -mfsgsbase --param l1-cache-size=16 --param l1-cache-line-size=64 --param l2-cache-size=2048 -mtune=bdver2 -dumpbase help-dummy -auxbase help-dummy -version --help=target -o /tmp/ccfUVZRL.s
The following options are target specific:
  -m128bit-long-double                  [disabled]
  -m32                                  [disabled]
  -m3dnow                               [disabled]
  -m3dnowa                              [disabled]
  -m64                                  [enabled]
  -m80387                               [enabled]
  -m8bit-idiv                           [disabled]
  -m96bit-long-double                   [enabled]
  -mabi=                                sysv
  -mabm                                 [enabled]
  -maccumulate-outgoing-args            [disabled]
  -maes                                 [enabled]
  -malign-double                        [disabled]
  -malign-functions=                    0
  -malign-jumps=                        0
  -malign-loops=                        0
  -malign-stringops                     [enabled]
  -mandroid                             [disabled]
  -march=                               bdver2
  -masm=                                att
  -mavx                                 [enabled]
  -mavx2                                [disabled]
  -mavx256-split-unaligned-load         [disabled]
  -mavx256-split-unaligned-store        [disabled]
  -mbionic                              [disabled]
  -mbmi                                 [enabled]
  -mbmi2                                [disabled]
  -mbranch-cost=                        0
  -mcld                                 [disabled]
  -mcmodel=                             32
  -mcpu=
  -mcrc32                               [disabled]
  -mcx16                                [enabled]
  -mdispatch-scheduler                  [disabled]
  -mf16c                                [enabled]
  -mfancy-math-387                      [enabled]
  -mfentry                              [enabled]
  -mfma                                 [enabled]
  -mfma4                                [enabled]
  -mforce-drap                          [disabled]
  -mfp-ret-in-387                       [enabled]
  -mfpmath=                             387
  -mfsgsbase                            [enabled]
  -mfused-madd
  -mglibc                               [enabled]
  -mhard-float                          [enabled]
  -mieee-fp                             [enabled]
  -mincoming-stack-boundary=            0
  -minline-all-stringops                [disabled]
  -minline-stringops-dynamically        [disabled]
  -mintel-syntax
  -mlarge-data-threshold=               0x10000
  -mlwp                                 [enabled]
  -mlzcnt                               [enabled]
  -mmmx                                 [disabled]
  -mmovbe                               [disabled]
  -mms-bitfields                        [disabled]
  -mno-align-stringops                  [disabled]
  -mno-fancy-math-387                   [disabled]
  -mno-push-args                        [disabled]
  -mno-red-zone                         [disabled]
  -mno-sse4                             [disabled]
  -momit-leaf-frame-pointer             [disabled]
  -mpc32                                [disabled]
  -mpc64                                [disabled]
  -mpc80                                [disabled]
  -mpclmul                              [enabled]
  -mpopcnt                              [enabled]
  -mprefer-avx128                       [disabled]
  -mpreferred-stack-boundary=           0
  -mpush-args                           [enabled]
  -mrdrnd                               [disabled]
  -mrecip                               [disabled]
  -mrecip=
  -mred-zone                            [enabled]
  -mregparm=                            0
  -mrtd                                 [disabled]
  -msahf                                [enabled]
  -msoft-float                          [disabled]
  -msse                                 [enabled]
  -msse2                                [enabled]
  -msse2avx                             [disabled]
  -msse3                                [enabled]
  -msse4                                [enabled]
  -msse4.1                              [enabled]
  -msse4.2                              [enabled]
  -msse4a                               [enabled]
  -msse5
  -msseregparm                          [disabled]
  -mssse3                               [enabled]
  -mstack-arg-probe                     [disabled]
  -mstackrealign                        [enabled]
  -mstringop-strategy=                  [default]
  -mtbm                                 [enabled]
  -mtls-dialect=                        gnu
  -mtls-direct-seg-refs                 [enabled]
  -mtune=                               bdver2
  -muclibc                              [disabled]
  -mveclibabi=                          [default]
  -mvect8-ret-in-mem                    [disabled]
  -mvzeroupper                          [disabled]
  -mx32                                 [disabled]
  -mxop                                 [enabled]

  Known assembler dialects (for use with the -masm-dialect= option):
    att intel

  Known ABIs (for use with the -mabi= option):
    ms sysv

  Known code models (for use with the -mcmodel= option):
    32 kernel large medium small

  Valid arguments to -mfpmath=:
    387 387+sse 387,sse both sse sse+387 sse,387

  Known vectorization library ABIs (for use with the -mveclibabi= option):
    acml svml

  Valid arguments to -mstringop-strategy=:
    byte_loop libcall loop rep_4byte rep_8byte rep_byte unrolled_loop

  Known TLS dialects (for use with the -mtls-dialect= option):
    gnu gnu2

GNU C (Gentoo 4.7.3-r1 p1.4, pie-0.5.5) version 4.7.3 (x86_64-pc-linux-gnu)
        compiled by GNU C version 4.7.3, GMP version 5.1.3, MPFR version 3.1.2, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
COLLECT_GCC_OPTIONS='-march=native' '-Q' '--help=target' '-v'
 /usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../x86_64-pc-linux-gnu/bin/as -v --64 -o /tmp/ccdPdxJK.o /tmp/ccfUVZRL.s
GNU assembler version 2.23.2 (x86_64-pc-linux-gnu) using BFD version (Gentoo 2.23.2 p1.0) 2.23.2


gcc -march=bdver2 -Q --help=target -v:

Using built-in specs.
COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/4.7.3/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.7.3/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-4.7.3-r1/work/gcc-4.7.3/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.7.3 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.3 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.3/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.3/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/include/g++-v4 --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.7.3/python --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.7.3-r1 p1.4, pie-0.5.5' --enable-libstdcxx-time --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib --with-multilib-list=m32,m64 --disable-altivec --disable-fixed-point --enable-targets=all --disable-libgcj --enable-libgomp --disable-libmudflap --disable-libssp --enable-lto --without-cloog --without-ppl
Thread model: posix
gcc version 4.7.3 (Gentoo 4.7.3-r1 p1.4, pie-0.5.5)
COLLECT_GCC_OPTIONS='-march=bdver2' '-Q' '--help=target' '-v'
 /usr/libexec/gcc/x86_64-pc-linux-gnu/4.7.3/cc1 -v help-dummy -dumpbase help-dummy -march=bdver2 -auxbase help-dummy -version --help=target -o /tmp/ccE5eN2b.s
The following options are target specific:
  -m128bit-long-double                  [disabled]
  -m32                                  [disabled]
  -m3dnow                               [disabled]
  -m3dnowa                              [disabled]
  -m64                                  [enabled]
  -m80387                               [enabled]
  -m8bit-idiv                           [disabled]
  -m96bit-long-double                   [enabled]
  -mabi=                                sysv
  -mabm                                 [disabled]
  -maccumulate-outgoing-args            [disabled]
  -maes                                 [disabled]
  -malign-double                        [disabled]
  -malign-functions=                    0
  -malign-jumps=                        0
  -malign-loops=                        0
  -malign-stringops                     [enabled]
  -mandroid                             [disabled]
  -march=                               bdver2
  -masm=                                att
  -mavx                                 [disabled]
  -mavx2                                [disabled]
  -mavx256-split-unaligned-load         [disabled]
  -mavx256-split-unaligned-store        [disabled]
  -mbionic                              [disabled]
  -mbmi                                 [disabled]
  -mbmi2                                [disabled]
  -mbranch-cost=                        0
  -mcld                                 [disabled]
  -mcmodel=                             32
  -mcpu=
  -mcrc32                               [disabled]
  -mcx16                                [disabled]
  -mdispatch-scheduler                  [disabled]
  -mf16c                                [disabled]
  -mfancy-math-387                      [enabled]
  -mfentry                              [enabled]
  -mfma                                 [disabled]
  -mfma4                                [disabled]
  -mforce-drap                          [disabled]
  -mfp-ret-in-387                       [enabled]
  -mfpmath=                             387
  -mfsgsbase                            [disabled]
  -mfused-madd
  -mglibc                               [enabled]
  -mhard-float                          [enabled]
  -mieee-fp                             [enabled]
  -mincoming-stack-boundary=            0
  -minline-all-stringops                [disabled]
  -minline-stringops-dynamically        [disabled]
  -mintel-syntax
  -mlarge-data-threshold=               0x10000
  -mlwp                                 [disabled]
  -mlzcnt                               [disabled]
  -mmmx                                 [disabled]
  -mmovbe                               [disabled]
  -mms-bitfields                        [disabled]
  -mno-align-stringops                  [disabled]
  -mno-fancy-math-387                   [disabled]
  -mno-push-args                        [disabled]
  -mno-red-zone                         [disabled]
  -mno-sse4                             [enabled]
  -momit-leaf-frame-pointer             [disabled]
  -mpc32                                [disabled]
  -mpc64                                [disabled]
  -mpc80                                [disabled]
  -mpclmul                              [disabled]
  -mpopcnt                              [disabled]
  -mprefer-avx128                       [disabled]
  -mpreferred-stack-boundary=           0
  -mpush-args                           [enabled]
  -mrdrnd                               [disabled]
  -mrecip                               [disabled]
  -mrecip=
  -mred-zone                            [enabled]
  -mregparm=                            0
  -mrtd                                 [disabled]
  -msahf                                [disabled]
  -msoft-float                          [disabled]
  -msse                                 [disabled]
  -msse2                                [disabled]
  -msse2avx                             [disabled]
  -msse3                                [disabled]
  -msse4                                [disabled]
  -msse4.1                              [disabled]
  -msse4.2                              [disabled]
  -msse4a                               [disabled]
  -msse5
  -msseregparm                          [disabled]
  -mssse3                               [disabled]
  -mstack-arg-probe                     [disabled]
  -mstackrealign                        [enabled]
  -mstringop-strategy=                  [default]
  -mtbm                                 [disabled]
  -mtls-dialect=                        gnu
  -mtls-direct-seg-refs                 [enabled]
  -mtune=
  -muclibc                              [disabled]
  -mveclibabi=                          [default]
  -mvect8-ret-in-mem                    [disabled]
  -mvzeroupper                          [disabled]
  -mx32                                 [disabled]
  -mxop                                 [disabled]

  Known assembler dialects (for use with the -masm-dialect= option):
    att intel

  Known ABIs (for use with the -mabi= option):
    ms sysv

  Known code models (for use with the -mcmodel= option):
    32 kernel large medium small

  Valid arguments to -mfpmath=:
    387 387+sse 387,sse both sse sse+387 sse,387

  Known vectorization library ABIs (for use with the -mveclibabi= option):
    acml svml

  Valid arguments to -mstringop-strategy=:
    byte_loop libcall loop rep_4byte rep_8byte rep_byte unrolled_loop

  Known TLS dialects (for use with the -mtls-dialect= option):
    gnu gnu2

GNU C (Gentoo 4.7.3-r1 p1.4, pie-0.5.5) version 4.7.3 (x86_64-pc-linux-gnu)
        compiled by GNU C version 4.7.3, GMP version 5.1.3, MPFR version 3.1.2, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
COLLECT_GCC_OPTIONS='-march=bdver2' '-Q' '--help=target' '-v'
 /usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../x86_64-pc-linux-gnu/bin/as -v --64 -o /tmp/cc7Uelkz.o /tmp/ccE5eN2b.s
GNU assembler version 2.23.2 (x86_64-pc-linux-gnu) using BFD version (Gentoo 2.23.2 p1.0) 2.23.2


It's hard to see without a side-by-side comparison due to the wall of text, but look in particular at the -msse* stuff; In one they're listed as enabled and in the other not, even tho' the implied -march is the same!

Weird, no?

There are also some other odd anomalies; I didn't think you could use the '387 in 64-bit mode, and that -mfpmath should default to sse anyway, yet it clearly says 387 in both.
Also, -mmmx is disabled even tho' tho the chip supports it, and -fomit-frame-pointer is disabled, when the docs say it should default to on with 64-bit?
Back to top
View user's profile Send private message
Cyker
Veteran
Veteran


Joined: 15 Jun 2006
Posts: 1746

PostPosted: Thu Jul 24, 2014 8:32 am    Post subject: Reply with quote

Ah looks like it is just a bug with gcc's display of the options; If you run
Code:
echo 'int main() {return 0;}' > test.c && gcc -v -Q -march=native -O2 test.c -o test && rm test.c test
or
Code:
echo 'int main() {return 0;}' > test.c && gcc -v -Q -march=bdver2 -O2 test.c -o test && rm test.c test
the right flags and things are listed there.
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Thu Jul 24, 2014 8:38 am    Post subject: Reply with quote

It just output options set by -march
And when using native it output options set by march and option set by the detection.

It's easier to see with i686 and -m64 option
Code:
gcc -march=corei7 -Q --help=target -v | grep 64
...
  -m64                              [disabled]
  -mpc64                            [disabled]

it run i686 but it output what is ok to do with corei7, so even in i686 it output -m64 as possible option to use.

Code:
gcc -march=native -Q --help=target -v | grep 64
...
  -mpc64                            [disabled]

Now in native, it see the arch is i686, and that the -m64 is no more an option we can pick. And the option disappear.

That's why i have words with a dev that complain bug report with long CFLAGS will be drop ; well in native we could use short CFLAGS, but with distcc we must use the -march=cputype of your cpu, and then you must write every options -march=native enable, but that aren't enable per default when using -march=cputype
Code:
gcc -march=native -Q --help=target -v  | grep msse
  -msse                             [enabled]
gcc -march=corei7 -Q --help=target -v  | grep msse
  -msse                             [disabled]
gcc -march=corei7 -Q --help=target -v -msse | grep sse
  -msse                             [enabled]



Why you think coprocessor cannot be use in 64bits?
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Thu Jul 24, 2014 4:53 pm    Post subject: Reply with quote

krinn wrote:
That's why i have words with a dev that complain bug report with long CFLAGS will be drop ; well in native we could use short CFLAGS, but with distcc we must use the -march=cputype of your cpu, and then you must write every options -march=native enable, but that aren't enable per default when using -march=cputype

Yeah that's a good point; if emerge --info shows distcc in use, that cannot apply.
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Mon Jul 28, 2014 11:07 pm    Post subject: Reply with quote

Just for reference, here's what I use to expand -march=native for distcc:
Code:
#!/bin/sh
echo $(
    gcc -v -march=native -x c /dev/null 2>&1 \
        | grep -- '-march' \
        | ack -o --color --match "(?<=\s)-(?:m|-param )\\S+"
)

The output's not all that long, and follows a pretty obvious pattern. (IMO anyone complaining about something so inconsequential can't be trusted to fix bugs competently anyway...)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo 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