Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 384189 - sys-devel/gcc-4.5.3-r1 doesn't use "-mtune=k8-sse3" when using "-march=native"
Summary: sys-devel/gcc-4.5.3-r1 doesn't use "-mtune=k8-sse3" when using "-march=native"
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-23 11:38 UTC by Pacho Ramos
Modified: 2011-09-24 00:32 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Output (gcc.output,6.95 KB, text/plain)
2011-09-23 15:33 UTC, Pacho Ramos
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pacho Ramos gentoo-dev 2011-09-23 11:38:32 UTC
This is not a regression over gcc-4.4, but I don't understand why it doesn't tune for k8-sse3 even if my processor has sse3 support and it's detected for -march:

\_ /usr/libexec/gcc/x86_64-pc-linux-gnu/4.5.3/cc1 -quiet - -D_FORTIFY_SOURCE=2 -march=k8-sse3 -msahf --param l1-cache-size=64 --param l1-cache-line-size=64 --param l2-cache-size=512 -mtune=k8 -quiet -dumpbase - -auxbase-strip /dev/null -o /tmp/ccm0bSsZ.s

My emerge --info:

If I don't misremember, this is a Venice:
http://en.wikipedia.org/wiki/Athlon_64#Venice_.2890.C2.A0nm_SOI.29

Portage 2.1.10.19 (default/linux/amd64/10.0/desktop/gnome, gcc-4.5.3, glibc-2.12.2-r0, 2.6.39-gentoo-r1 x86_64)
=================================================================
System uname: Linux-2.6.39-gentoo-r1-x86_64-AMD_Athlon-tm-_64_Processor_3200+-with-gentoo-2.0.3
Timestamp of tree: Thu, 22 Sep 2011 19:00:01 +0000
app-shells/bash:          4.1_p9
dev-java/java-config:     2.1.11-r3
dev-lang/python:          2.7.1-r1, 3.1.3-r1
dev-util/cmake:           2.8.4-r1
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.0.3
sys-apps/openrc:          0.8.3-r1
sys-apps/sandbox:         2.4
sys-devel/autoconf:       2.13, 2.68
sys-devel/automake:       1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:       2.21.1-r1
sys-devel/gcc:            4.4.5, 4.5.3-r1
sys-devel/gcc-config:     1.4.1-r1
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r1
sys-kernel/linux-headers: 2.6.36.1 (virtual/os-headers)
sys-libs/glibc:           2.12.2
Repositories: gentoo sunrise x-portage
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/usr/distfiles"
FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles fixpackages multilib-strict news parallel-fetch protect-owned sandbox sfperms sign split-log strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS=""
GENTOO_MIRRORS="http://mirror.ovh.net/gentoo-distfiles/ http://ftp.heanet.ie/pub/gentoo/"
LANG="es_ES.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu"
LINGUAS="es es_ES en_US"
MAKEOPTS="-j2"
PKGDIR="/usr/local/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/portage/local/layman/sunrise /usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="3dnow 3dnowext X a52 aac acl acpi alsa amd64 applet avahi bash-completion berkdb branding bzip2 cairo cdda cddb cdinstall cdr cdrom cleartype cli consolekit cracklib crypt css cups cxx daap dbus djvu dri dts dvd dvdr dvi eds emboss encode evo exif fam fat ffmpeg firefox flac fortran fuse gdbm gdu gif git gnome gnome-keyring gpm gstreamer gtk gtk3 hddtemp iconv java jpeg kpathsea latex lcdfilter lcms libnotify lm_sensors lyx lzma mad mms mmx mmxext mng modules mono mp3 mp4 mpeg mudflap multilib musicbrainz nautilus ncurses network network-cron nfs nls nptl nptlonly ntfs nvidia ogg opengl openmp pam pango pch pcre pdf perl png policykit ppds pppd python qt3support qt4 readline reiserfs scanner sdl session sound spell sse sse2 sse3 ssl startup-notification subversion svg sysfs t1lib tcpd threads tiff truetype udev unicode usb v4l2 vcd vorbis webkit x264 xattr xcb xml xmp xorg xpm xulrunner xv xvid zeroconf zlib" ALSA_CARDS="via82xx" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="es es_ES en_US" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="nvidia vesa" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS


Reproducible: Always




$ cat /proc/cpuinfo 
processor	: 0
vendor_id	: AuthenticAMD
cpu family	: 15
model		: 47
model name	: AMD Athlon(tm) 64 Processor 3200+
stepping	: 0
cpu MHz		: 2042.838
cache size	: 512 KB
fpu		: yes
fpu_exception	: yes
cpuid level	: 1
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx mmxext fxsr_opt lm 3dnowext 3dnow rep_good nopl pni lahf_lm
bogomips	: 4085.67
TLB size	: 1024 4K pages
clflush size	: 64
cache_alignment	: 64
address sizes	: 40 bits physical, 48 bits virtual
power management: ts fid vid ttp tm stc
Comment 1 Pacho Ramos gentoo-dev 2011-09-23 11:40:10 UTC
Output as requested in https://bugs.gentoo.org/show_bug.cgi?id=384129#c3

$ gcc cpuid.c && ./a.out
0x1: 0x20ff0 0x800 0x1 0x78bfbff
0x80000000: 0x80000018 0x68747541 0x444d4163 0x69746e65
0x80000001: 0x20ff0 0x10a 0x1 0xe3d3fbff
0x80000002: 0x20444d41 0x6c687441 0x74286e6f 0x3620296d
Comment 2 Kacper Kowalik (Xarthisius) (RETIRED) gentoo-dev 2011-09-23 13:51:46 UTC
What about `echo | gcc -dM -E - -march=native` ? does it show SSE3 being defined?
Comment 3 Pacho Ramos gentoo-dev 2011-09-23 15:33:54 UTC
Created attachment 287517 [details]
Output

Looks like it's defined, but I attach full output to let you check
Comment 4 Pacho Ramos gentoo-dev 2011-09-23 16:41:06 UTC
With gcc-4.6 I get the same:

/usr/libexec/gcc/x86_64-pc-linux-gnu/4.6.1/cc1 -quiet - -D_FORTIFY_SOURCE=2 -march=k8-sse3 -mno-cx16 -msahf -mno-movbe -mno-aes -mno-pclmul -mno-popcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-tbm -mno-avx -mno-sse4.2 -mno-sse4.1 --param l1-cache-size=64 --param l1-cache-line-size=64 --param l2-cache-size=512 -mtune=k8 -quiet -dumpbase - -auxbase-strip /dev/null -o /tmp/cc3rKW9V.s
Comment 5 Ryan Hill (RETIRED) gentoo-dev 2011-09-24 00:32:17 UTC
Probably because you don't "tune" for an instruction set.  It doesn't make sense.  -mtune controls things like scheduling behavior, prefetching, branch costs, etc.  These don't change when you tack on SSE3 instructions.  -march is what controls which instructions sets are used.  As far as tuning is concerned k8 and k8-sse3 are the exact same thing, because gcc has one cost model (struct processor_costs k8_cost in gcc/config/i386.c) and machine model (m_K8 in same) it uses for all K8 family chips.