Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

x86/crc32: improve crc32c_arch() code generation with clang

crc32c_arch() is affected by
https://github.com/llvm/llvm-project/issues/20571 where clang
unnecessarily spills the inputs to "rm"-constrained operands to the
stack. Replace "rm" with ASM_INPUT_RM which partially works around this
by expanding to "r" when the compiler is clang. This results in better
code generation with clang, though still not optimal.

Link: https://lore.kernel.org/r/20250210210741.471725-1-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>

+2 -2
+2 -2
arch/x86/lib/crc32-glue.c
··· 55 55 56 56 for (num_longs = len / sizeof(unsigned long); 57 57 num_longs != 0; num_longs--, p += sizeof(unsigned long)) 58 - asm(CRC32_INST : "+r" (crc) : "rm" (*(unsigned long *)p)); 58 + asm(CRC32_INST : "+r" (crc) : ASM_INPUT_RM (*(unsigned long *)p)); 59 59 60 60 for (len %= sizeof(unsigned long); len; len--, p++) 61 - asm("crc32b %1, %0" : "+r" (crc) : "rm" (*p)); 61 + asm("crc32b %1, %0" : "+r" (crc) : ASM_INPUT_RM (*p)); 62 62 63 63 return crc; 64 64 }