diff --git a/arch/risc-v/src/cmake/Toolchain.cmake b/arch/risc-v/src/cmake/Toolchain.cmake index b155953a05..e3c82031fb 100644 --- a/arch/risc-v/src/cmake/Toolchain.cmake +++ b/arch/risc-v/src/cmake/Toolchain.cmake @@ -343,21 +343,19 @@ if(CONFIG_RISCV_TOOLCHAIN STREQUAL GNU_RVG) # These models can't cover all implementation of RISCV, but it's enough for # most cases. - set(LLVM_CPUFLAGS) - if(CONFIG_ARCH_RV32) - if(${ARCHCPUEXTFLAGS} STREQUAL imc) - list(APPEND LLVM_CPUFLAGS -mcpu=sifive-e20) - elseif(${ARCHCPUEXTFLAGS} STREQUAL imac) - list(APPEND LLVM_CPUFLAGS -mcpu=sifive-e31) - elseif(${ARCHCPUEXTFLAGS} STREQUAL imafc) - list(APPEND LLVM_CPUFLAGS -mcpu=sifive-e76) + if(${ARCHCPUEXTFLAGS} MATCHES "^imc") + set(LLVM_CPUTYPE "sifive-e20") + elseif(${ARCHCPUEXTFLAGS} MATCHES "^imac") + set(LLVM_CPUTYPE "sifive-e31") + elseif(${ARCHCPUEXTFLAGS} MATCHES "^imafc") + set(LLVM_CPUTYPE "sifive-e76") endif() else() - if(${ARCHCPUEXTFLAGS} STREQUAL imac) - list(APPEND LLVM_CPUFLAGS -mcpu=sifive-s51) - elseif(${ARCHCPUEXTFLAGS} STREQUAL imafdc) - list(APPEND LLVM_CPUFLAGS -mcpu=sifive-u54) + if(${ARCHCPUEXTFLAGS} MATCHES "^imac") + set(LLVM_CPUTYPE "sifive-s51") + elseif(${ARCHCPUEXTFLAGS} MATCHES "^imafdc") + set(LLVM_CPUTYPE "sifive-u54") endif() endif()