https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91934
Bug ID: 91934 Summary: Performance regression on 8.3.0 with -O3 and avx Product: gcc Version: 8.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: tochansky at tochlab dot net Target Milestone: --- Created attachment 46980 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46980&action=edit Function where problem occurs GCC version is 8.3.0 building on Gentoo. Configured with: /var/tmp/portage/sys-devel/gcc-8.3.0-r1/work/gcc-8.3.0/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/8.3.0 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/8.3.0 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/8.3.0/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/8.3.0/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include/g++-v8 --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/8.3.0/python --enable-languages=c,c++,go,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 8.3.0-r1 p1.1' --disable-esp --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 --enable-libgomp --disable-libmudflap --disable-libssp --disable-libmpx --disable-systemtap --enable-vtable-verify --enable-lto --without-isl --enable-default-pie --enable-default-ssp Thread model: posix gcc version 8.3.0 (Gentoo 8.3.0-r1 p1.1) Building my source with: -Wall -Wextra -Wshadow -pedantic -march=native -mavx -mavx2 -O3 -g -save-temps -std=gnu99 resulted .i file is attached. I got similar results on Debian 10 and godbolt.org (https://godbolt.org/z/-0cGgu) The problem is low performance when building with 8.3.0. I tested this code on 7.4.0, 8.3.0, 9.1.0 and generated assembler in 8.3.0 contains some strange SIMD instructions before main work. Problem occurs only with -O3 flag.