[clang] [RISCV][FMV] Support target_version (PR #99040)

Piyou Chen via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 13 21:07:24 PDT 2024


================
@@ -10319,8 +10319,10 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
   // Handle attributes.
   ProcessDeclAttributes(S, NewFD, D);
   const auto *NewTVA = NewFD->getAttr<TargetVersionAttr>();
-  if (NewTVA && !NewTVA->isDefaultVersion() &&
-      !Context.getTargetInfo().hasFeature("fmv")) {
+  if (Context.getTargetInfo().getTriple().isRISCV()) {
----------------
BeMg wrote:

My understand is the `fmv` is a aarch64 feature to control the function multi-versioning. They(target_version and fmv) are both be introduced by [this commit](https://github.com/llvm/llvm-project/commit/fe5cf480ee5ae0d14eb62f32e55a33d2ccf67dd1). 

The [ACLE spec](https://arm-software.github.io/acle/main/acle.html#function-multi-versioning) and [review comment](https://reviews.llvm.org/D127812) can help to understand the context.

Additionally, it is treated as a generic option in the [Clang command-line options](https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-mno-fmv), and it was also introduced in the same commit.

---

Do you think it's a good idea to add this similar feature to RISC-V, or should we just skip it?

https://github.com/llvm/llvm-project/pull/99040


More information about the cfe-commits mailing list