[PATCH] D155155: [RISCV] emit .option directive for functions with target features which differ from module default

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 13 08:16:23 PDT 2023


reames added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp:256
+      continue;
+    if (STI->hasFeature(Feature.Value) && !MCSTI.hasFeature(Feature.Value))
+      NeedEmitStdOptionArgs.emplace_back(RISCVOptionArchArgType::Plus,
----------------
Suggestion:


```
if (STI->hasFeature(Feature.Value) == MCSTI.hasFeature(Feature.Value))
  continue;
auto Delta = STI->hasFeature(Feature.Value) ?  RISCVOptionArchArgType::Plus : RISCVOptionArchArgType::Minus;   
NeedEmitStdOptionArgs.emplace_back(Delta, Feature.Key);
```


================
Comment at: llvm/test/CodeGen/RISCV/riscv-func-attr-target.ll:1
+; RUN: llc -mtriple=riscv64 -mattr=+a,+d,+f,+m -verify-machineinstrs < %s | FileCheck %s
+
----------------
Change the test name to riscv-func-target-feature.ll


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155155/new/

https://reviews.llvm.org/D155155



More information about the llvm-commits mailing list