From ab750eab5f1620c897f04564a58944570a791451 Mon Sep 17 00:00:00 2001 From: Marcin Szymczyk Date: Wed, 11 Jun 2025 16:41:57 +0200 Subject: [PATCH] cmake: compiler: gcc: riscv: remove spurious Zmmul Zmmul is a subset of M extension. No need to enable Zmmul redundantly if M is already present. Reference: https://github.com/riscv/riscv-isa-manual/blob/449cd0c79ae91cc6f547726b8a6270f975be676e/src/m.tex#L173 https://github.com/riscv/riscv-isa-manual/issues/869 Signed-off-by: Marcin Szymczyk --- cmake/compiler/gcc/target_riscv.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/compiler/gcc/target_riscv.cmake b/cmake/compiler/gcc/target_riscv.cmake index 95ef3f63c9f..4e83f5d187b 100644 --- a/cmake/compiler/gcc/target_riscv.cmake +++ b/cmake/compiler/gcc/target_riscv.cmake @@ -81,7 +81,9 @@ if(CONFIG_RISCV_ISA_EXT_ZBS) string(CONCAT riscv_march ${riscv_march} "_zbs") endif() -if(CONFIG_RISCV_ISA_EXT_ZMMUL AND +# Check whether we already imply Zmmul by selecting the M extension; if not - enable it +if(NOT CONFIG_RISCV_ISA_EXT_M AND + CONFIG_RISCV_ISA_EXT_ZMMUL AND "${GCC_COMPILER_VERSION}" VERSION_GREATER_EQUAL 13.0.0) string(CONCAT riscv_march ${riscv_march} "_zmmul") endif()