summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorCharlie Jenkins <charlie@rivosinc.com>2024-01-18 14:36:45 -0800
committerPalmer Dabbelt <palmer@rivosinc.com>2024-01-18 14:41:38 -0800
commit4525462dd0db9e86bb67c10dedbbaa4f8d62697d (patch)
treef089c531e3c91a419ae2bf705b02c63a3ad48d74 /arch
parent66f962d8939fd2ac74de901d30d30310c8ddca79 (diff)
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: a04c192eabfb ("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>
Diffstat (limited to 'arch')
-rw-r--r--arch/riscv/lib/csum.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/riscv/lib/csum.c b/arch/riscv/lib/csum.c
index 06ce8e7250d9..af3df5274ccb 100644
--- a/arch/riscv/lib/csum.c
+++ b/arch/riscv/lib/csum.c
@@ -156,6 +156,7 @@ do_csum_with_alignment(const unsigned char *buff, int len)
end = (const unsigned long *)(buff + len);
csum = do_csum_common(ptr, end, data);
+#ifdef CC_HAS_ASM_GOTO_TIED_OUTPUT
/*
* Zbb support saves 6 instructions, so not worth checking without
* alternatives if supported
@@ -214,6 +215,7 @@ end:
return csum >> 16;
}
no_zbb:
+#endif /* CC_HAS_ASM_GOTO_TIED_OUTPUT */
#ifndef CONFIG_32BIT
csum += ror64(csum, 32);
csum >>= 32;