Skip to content

Commit 4525462

Browse files
charlie-rivospalmer-dabbelt
authored andcommitted
riscv: lib: Check if output in asm goto supported
The output field of an asm goto statement is not supported by all compilers. If it is not supported, fallback to the non-optimized code. Signed-off-by: Charlie Jenkins <charlie@rivosinc.com> Fixes: a04c192 ("riscv: Add checksum library") Link: https://lore.kernel.org/r/20240118-csum_remove_output_operands_asm_goto-v2-1-5d1b73cf93d4@rivosinc.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
1 parent 66f962d commit 4525462

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

arch/riscv/lib/csum.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ do_csum_with_alignment(const unsigned char *buff, int len)
156156
end = (const unsigned long *)(buff + len);
157157
csum = do_csum_common(ptr, end, data);
158158

159+
#ifdef CC_HAS_ASM_GOTO_TIED_OUTPUT
159160
/*
160161
* Zbb support saves 6 instructions, so not worth checking without
161162
* alternatives if supported
@@ -214,6 +215,7 @@ do_csum_with_alignment(const unsigned char *buff, int len)
214215
return csum >> 16;
215216
}
216217
no_zbb:
218+
#endif /* CC_HAS_ASM_GOTO_TIED_OUTPUT */
217219
#ifndef CONFIG_32BIT
218220
csum += ror64(csum, 32);
219221
csum >>= 32;

0 commit comments

Comments
 (0)