https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124434
Bug ID: 124434
Summary: long double exceptions are 56x slower
Product: gcc
Version: 15.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: gnu at skewray dot com
Target Milestone: ---
Created attachment 63869
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=63869&action=edit
*.i file
I ran a floating speed test (multiply and add) for various floating types and
with and without exceptions. For optimized code, long double takes 56x longer
to run. For a user running a large floating computation (eg, matrix inversion),
this slowness could be misleading or confusing if the entire calculation is
munged by bad data. Float, double, and quad do not show this issue. The issue
also goes away for -O1 or higher. Here is the time table, normalized to
float=1:
TYPE NUM INF NAN
float 1.00 0.99 0.99
double 0.99 0.99 0.99
long 1.25 69.68 72.13
quad 8.42 5.99 6.61
% gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-gnu/15/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 15.2.0-4ubuntu4'
--with-bugurl=file:///usr/share/doc/gcc-15/README.Bugs
--enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2,rust,cobol,algol68
--prefix=/usr --with-gcc-major-version-only --program-suffix=-15
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace
--enable-gnu-unique-object --disable-vtable-verify --enable-plugin
--enable-default-pie --with-system-zlib --enable-libphobos-checking=release
--with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch
--disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64
--with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic
--enable-offload-targets=nvptx-none=/build/gcc-15-deiAlw/gcc-15-15.2.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-15-deiAlw/gcc-15-15.2.0/debian/tmp-gcn/usr
--enable-offload-defaulted --without-cuda-driver --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
--with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 15.2.0 (Ubuntu 15.2.0-4ubuntu4)
Processor: 13th Gen Intel® Core™ i9-13900 (24-Core, 32MB Cache, 2.0 GHz)
Build options: default (no flags)
Command line: "a.out"
Compiler output: none
Attached: *.i file