public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug driver/60233] New: AVX instructions emitted with -march=native on host without AVX support
@ 2014-02-16 22:50 steven at uplinklabs dot net
  2014-02-16 23:03 ` [Bug driver/60233] " pinskia at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: steven at uplinklabs dot net @ 2014-02-16 22:50 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 60233
           Summary: AVX instructions emitted with -march=native on host
                    without AVX support
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: driver
          Assignee: unassigned at gcc dot gnu.org
          Reporter: steven at uplinklabs dot net
              Host: x86_64-unknown-linux-gnu
            Target: x86_64-unknown-linux-gnu
             Build: x86_64-unknown-linux-gnu

Running GCC in a paravirtual Xen guest on an Ivy Bridge host. The PV guest does
not have AVX support, and -march=native seems to detect this correctly:

$ gcc -O2 -march=native -E -v - </dev/null 2>&1 | grep cc1
 /usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/cc1 -E -quiet -v -
-march=core-avx-i -mcx16 -msahf -mno-movbe -maes -mpclmul -mpopcnt -mno-abm
-mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-bmi2 -mno-tbm -mno-avx
-mno-avx2 -msse4.2 -msse4.1 -mno-lzcnt -mno-rtm -mno-hle -mrdrnd -mf16c
-mfsgsbase -mno-rdseed -mno-prfchw -mno-adx -mfxsr -mno-xsave -mno-xsaveopt
--param l1-cache-size=32 --param l1-cache-line-size=64 --param
l2-cache-size=25600 -mtune=core-avx-i -O2


Note in particular the -mno-avx and -mno-xsave.

However, GCC is still emitting AVX instructions:

$ cat vadd8.c
typedef float v8f __attribute__ ((vector_size(32), aligned(1)));

void vadd8f(v8f *o, v8f *a, v8f *b)
{
        *o = *a + *b;
}

$ echo | gcc -dM -E - -march=native | grep AVX
#define __AVX__ 1

$ gcc -O2 -march=native -c vadd8.c

$ objdump -S vadd8.o

vadd8.o:     file format elf64-x86-64


Disassembly of section .text:

0000000000000000 <vadd8f>:
   0:   c5 f8 10 0e             vmovups (%rsi),%xmm1
   4:   c5 f8 10 02             vmovups (%rdx),%xmm0
   8:   c4 e3 75 18 4e 10 01    vinsertf128 $0x1,0x10(%rsi),%ymm1,%ymm1
   f:   c4 e3 7d 18 42 10 01    vinsertf128 $0x1,0x10(%rdx),%ymm0,%ymm0
  16:   c5 f4 58 c0             vaddps %ymm0,%ymm1,%ymm0
  1a:   c5 f8 11 07             vmovups %xmm0,(%rdi)
  1e:   c4 e3 7d 19 47 10 01    vextractf128 $0x1,%ymm0,0x10(%rdi)
  25:   c5 f8 77                vzeroupper 
  28:   c3                      retq   

I'm guessing that the -march=core-avx-i it decided on is overriding the
-mno-avx flag, but this seems to be a regression to me.

Version information:

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /build/gcc/src/gcc-4.8-20140206/configure --prefix=/usr
--libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared
--enable-threads=posix --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch
--disable-libssp --enable-gnu-unique-object --enable-linker-build-id
--enable-cloog-backend=isl --disable-cloog-version-check --enable-lto
--enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu
--disable-multilib --disable-werror --enable-checking=release
Thread model: posix
gcc version 4.8.2 20140206 (prerelease) (GCC)


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

end of thread, other threads:[~2014-02-18  8:17 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-16 22:50 [Bug driver/60233] New: AVX instructions emitted with -march=native on host without AVX support steven at uplinklabs dot net
2014-02-16 23:03 ` [Bug driver/60233] " pinskia at gcc dot gnu.org
2014-02-16 23:05 ` steven at uplinklabs dot net
2014-02-16 23:07 ` steven at uplinklabs dot net
2014-02-17  6:33 ` jakub at gcc dot gnu.org
2014-02-17  8:43 ` ubizjak at gmail dot com
2014-02-17  9:50 ` jakub at gcc dot gnu.org
2014-02-18  7:20 ` jakub at gcc dot gnu.org
2014-02-18  7:24 ` jakub at gcc dot gnu.org
2014-02-18  7:32 ` jakub at gcc dot gnu.org
2014-02-18  7:32 ` jakub at gcc dot gnu.org
2014-02-18  8:17 ` steven at uplinklabs dot net

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