https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71467
Bug ID: 71467 Summary: extra store for -mavx -mno-avx Product: gcc Version: 5.3.1 Status: UNCONFIRMED Keywords: missed-optimization, ssemmx Severity: minor Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: mirq-gccboogs at rere dot qmqm.pl Target Milestone: --- Host: x86_64-linux-gnu Target: x86_64-linux-gnu Created attachment 38664 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38664&action=edit test case Code: typedef int __v8si __attribute__ ((__vector_size__ (32))); void vz(__v8si *v) { *v <<= 1; } Compiles to: vz: .LFB0: .cfi_startproc leaq 8(%rsp), %r10 .cfi_def_cfa 10, 0 andq $-32, %rsp pushq -8(%r10) pushq %rbp .cfi_escape 0x10,0x6,0x2,0x76,0 movq %rsp, %rbp pushq %r10 .cfi_escape 0xf,0x3,0x76,0x78,0x6 vmovdqa (%rdi), %xmm2 vmovdqa 16(%rdi), %xmm4 vpslld $1, %xmm2, %xmm1 vpslld $1, %xmm4, %xmm3 vmovaps %xmm1, -48(%rbp) vmovaps %xmm3, -32(%rbp) vmovdqa -48(%rbp), %ymm5 vmovdqa %ymm5, (%rdi) vzeroupper popq %r10 .cfi_def_cfa 10, 0 popq %rbp leaq -8(%r10), %rsp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size vz, .-vz This should be no more than: vmovdqa (%rdi), %xmm2 vmovdqa 16(%rdi), %xmm4 vpslld $1, %xmm2, %xmm1 vpslld $1, %xmm4, %xmm3 vmovaps %xmm1, (%rdi) vmovaps %xmm3, 16(%rdi) ret Compiled with: $ gcc -O3 -mavx -mno-avx2 -S -o - a.c $ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 5.3.1-21' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 5.3.1 20160528 (Debian 5.3.1-21) Same with: Using built-in specs. COLLECT_GCC=gcc-4.9 COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.9/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 4.9.3-14' --with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.9 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.9 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --with-arch-32=i586 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.9.3 (Debian 4.9.3-14)