]> git.alsa-project.org Git - alsa-lib.git/commit
pcm: dmix: i386: keep the size operand in memory
authorYegor Yefremov <yegorslists@googlemail.com>
Fri, 23 Oct 2026 23:18:15 +0000 (01:18 +0200)
committerJaroslav Kysela <perex@perex.cz>
Mon, 30 Nov 2026 14:04:18 +0000 (15:04 +0100)
commit5aa1c3d38be43f9186e325b9aec00abac4549913
tree8c9251ab9453eaa049461806dd874f5988ce9178
parent6633fb0779fb0e6f2968d81e669d0be3578f993c
pcm: dmix: i386: keep the size operand in memory

The i386 mix_areas_*() assembly clobbers esi, edi, edx, ecx, eax and
(since gcc 5, even in PIC mode) ebx. When gcc also needs ebp as frame
pointer, which it does at -Os, no general purpose register is left.

Commit abc9f32cf45c ("pcm: dmix: assembly: give more freedom over the
constraints") relaxed the size operand from "+m" to "+&rm". With
AVX512BW enabled (e.g. -march=skylake-avx512, cannonlake, icelake or
x86-64-v4) and -Os or -Oz, gcc 15 and gcc 16 then fail to pick the
memory alternative and abort:

  pcm_dmix_i386.h:52:9: error: 'asm' operand has impossible constraints or there are not enough registers

As the asm already uses all registers, restore the "+m" constraint for
size, as used before that commit. The loop decrementing it in memory
also does read-modify-write operations on dst and sum, so the extra
memory access has a negligible cost.

Closes: https://github.com/alsa-project/alsa-lib/pull/537
Fixes: abc9f32cf45c ("pcm: dmix: assembly: give more freedom over the constraints")
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
src/pcm/pcm_dmix_i386.h