[PATCH] D145883: [Flang][RISCV] Emit target features for RISC-V

Shao-Ce SUN via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 12 11:48:13 PDT 2023


sunshaoce created this revision.
sunshaoce added reviewers: awarzynski, klausler, clementval, sscalpone, craig.topper, jrtc27, kito-cheng.
Herald added subscribers: VincentWu, vkmr, evandro, luismarques, sameer.abuasal, s.egerton, Jim, benna, psnobl, PkmX, rogfer01, shiva0217, simoncook, arichardson.
Herald added projects: Flang, All.
sunshaoce requested review of this revision.
Herald added subscribers: cfe-commits, pcwang-thead, eopXD, jdoerfert, MaskRay.
Herald added a project: clang.

Fix the issue of .o file generated by `Flang` 
with `Flags` info is 0x0 under RISC-V.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D145883

Files:
  clang/lib/Driver/ToolChains/Flang.cpp
  flang/test/Driver/target-features.f90


Index: flang/test/Driver/target-features.f90
===================================================================
--- /dev/null
+++ flang/test/Driver/target-features.f90
@@ -0,0 +1,4 @@
+! RUN: %flang --target=riscv64-linux-gnu --target=riscv64 -c %s -### 2>&1 \
+! RUN: | FileCheck %s -check-prefix=CHECK-RV64
+
+! CHECK-RV64: "-target-feature" "+m" "-target-feature" "+a" "-target-feature" "+c" "-target-feature" "-e" "-target-feature" "-f" "-target-feature" "-d" "-target-feature" "-h" "-target-feature" "-zihintpause" "-target-feature" "-zfhmin" "-target-feature" "-zfh" "-target-feature" "-zfinx" "-target-feature" "-zdinx" "-target-feature" "-zhinxmin" "-target-feature" "-zhinx" "-target-feature" "-zba" "-target-feature" "-zbb" "-target-feature" "-zbc" "-target-feature" "-zbs" "-target-feature" "-zbkb" "-target-feature" "-zbkc" "-target-feature" "-zbkx" "-target-feature" "-zknd" "-target-feature" "-zkne" "-target-feature" "-zknh" "-target-feature" "-zksed" "-target-feature" "-zksh" "-target-feature" "-zkr" "-target-feature" "-zkn" "-target-feature" "-zks" "-target-feature" "-zkt" "-target-feature" "-zk" "-target-feature" "-zmmul" "-target-feature" "-v" "-target-feature" "-zvl32b" "-target-feature" "-zvl64b" "-target-feature" "-zvl128b" "-target-feature" "-zvl256b" "-target-feature" "-zvl512b" "-target-feature" "-zvl1024b" "-target-feature" "-zvl2048b" "-target-feature" "-zvl4096b" "-target-feature" "-zvl8192b" "-target-feature" "-zvl16384b" "-target-feature" "-zvl32768b" "-target-feature" "-zvl65536b" "-target-feature" "-zve32x" "-target-feature" "-zve32f" "-target-feature" "-zve64x" "-target-feature" "-zve64f" "-target-feature" "-zve64d" "-target-feature" "-zicbom" "-target-feature" "-zicboz" "-target-feature" "-zicbop" "-target-feature" "-zicsr" "-target-feature" "-zifencei" "-target-feature" "-zawrs" "-target-feature" "-svnapot" "-target-feature" "-svpbmt" "-target-feature" "-svinval" "-target-feature" "-xtheadba" "-target-feature" "-xtheadbb" "-target-feature" "-xtheadbs" "-target-feature" "-xtheadcmo" "-target-feature" "-xtheadcondmov" "-target-feature" "-xtheadfmemidx" "-target-feature" "-xtheadmac" "-target-feature" "-xtheadmemidx" "-target-feature" "-xtheadmempair" "-target-feature" "-xtheadsync" "-target-feature" "-xtheadvdot" "-target-feature" "-xventanacondops" "-target-feature" "-experimental-zihintntl" "-target-feature" "-experimental-zca" "-target-feature" "-experimental-zcb" "-target-feature" "-experimental-zcd" "-target-feature" "-experimental-zcf" "-target-feature" "-experimental-zfa" "-target-feature" "-experimental-zvfh" "-target-feature" "-experimental-ztso" "-target-feature" "+relax" "-target-feature" "-save-restore"
Index: clang/lib/Driver/ToolChains/Flang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Flang.cpp
+++ clang/lib/Driver/ToolChains/Flang.cpp
@@ -109,6 +109,9 @@
   case llvm::Triple::x86_64:
     getTargetFeatures(D, Triple, Args, CmdArgs, /*ForAs*/ false);
     break;
+  case llvm::Triple::riscv64:
+    getTargetFeatures(D, Triple, Args, CmdArgs, /*ForAs*/ false);
+    break;
   }
 
   // TODO: Add target specific flags, ABI, mtune option etc.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145883.504460.patch
Type: text/x-patch
Size: 3188 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230312/4f159069/attachment.bin>


More information about the cfe-commits mailing list