https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93009
Bug ID: 93009 Summary: AVX512 FMA - wrong code generation Product: gcc Version: 9.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: regression Assignee: unassigned at gcc dot gnu.org Reporter: matthias.hochsteger at tuwien dot ac.at Target Milestone: --- Created attachment 47526 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47526&action=edit preprocessed code Hello, gcc 9.2 produces wrong output when compiling for AVX512 targets, depending on the optimization level. The preprocessed source file is attached. Correct output: > g++ -std=c++17 -march=skylake-avx512 -O1 test_fma.ii > g++ -std=c++17 -march=skylake-avx512 -O2 -fno-expensive-optimizations > test_fma.ii > 7.95851e-06 Wrong output: > g++ -std=c++17 -march=skylake-avx512 -O1 -fexpensive-optimizations test_fma.ii > g++ -std=c++17 -march=skylake-avx512 -O2 test_fma.ii > 1e-10 All four cases work if the (non-preprocessed) source file is compiled with gcc 8.3, or the target is "skylake" instead of "skylake-avx512". gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /build/gcc/src/gcc/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++,d --enable-shared --enable-threads=posix --with-system-zlib --with-isl --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-gnu-indirect-function --enable-multilib --disable-werror --enable-checking=release --enable-default-pie --enable-default-ssp --enable-cet=auto gdc_include_dir=/usr/include/dlang/gdc Thread model: posix gcc version 9.2.0 (GCC) Best, Matthias