Commit fd9e3452 removed -ffast-math from the compile flags. Under some
authorGeorg Chini <georg@chini.tk>
Sun, 21 Jul 2019 13:07:18 +0000 (15:07 +0200)
committerArun Raghavan <arun@arunraghavan.net>
Tue, 23 Jul 2019 20:48:23 +0000 (20:48 +0000)
conditions this may lead to massive slowdown of floating point operations
when underflows or denormals are encountered. In particular, this problem
was observed with the soxr resampler after applying
https://gitlab.freedesktop.org/pulseaudio/pulseaudio/merge_requests/120

Therefore this patch adds -ffast-math to the link flags of the pulseaudio
daemon. Linking with -ffast-math adds a procedure set_fast_math() to the
startup code of the daemon. On x86, the procedure sets bit 6 and 15 of the
mxcsr register. When these bits are set, denormals and results of
underflowing operations are truncated to 0.

src/Makefile.am
src/daemon/meson.build

index 03535fc..ede970b 100644 (file)
@@ -175,9 +175,9 @@ PREOPEN_LIBS = $(modlibexec_LTLIBRARIES)
 endif
 
 if FORCE_PREOPEN
-pulseaudio_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(IMMEDIATE_LDFLAGS) -dlpreopen force $(foreach f,$(PREOPEN_LIBS),-dlpreopen $(f))
+pulseaudio_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(IMMEDIATE_LDFLAGS) -ffast-math -dlpreopen force $(foreach f,$(PREOPEN_LIBS),-dlpreopen $(f))
 else
-pulseaudio_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(IMMEDIATE_LDFLAGS) -dlopen force $(foreach f,$(PREOPEN_LIBS),-dlopen $(f))
+pulseaudio_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(IMMEDIATE_LDFLAGS) -ffast-math -dlopen force $(foreach f,$(PREOPEN_LIBS),-dlopen $(f))
 endif
 
 if HAVE_SYSTEMD_DAEMON
index 59bf0a2..f246153 100644 (file)
@@ -28,6 +28,7 @@ executable('pulseaudio',
   pulseaudio_headers,
   install: true,
   include_directories : [configinc, topinc],
+  link_args : ['-ffast-math'],
   link_with : [libpulsecore, libpulsecommon, libpulse],
   dependencies : [ltdl_dep, cap_dep, dbus_dep, libsystemd_dep],
   c_args : pa_c_args,