[PATCH] D81188: [RISCV] Support experimental v extensions.

Hsiangkai Wang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 4 12:42:53 PDT 2020


HsiangKai created this revision.
HsiangKai added reviewers: MaskRay, rogfer01.
Herald added subscribers: cfe-commits, evandro, luismarques, apazos, sameer.abuasal, pzheng, s.egerton, lenary, Jim, benna, psnobl, jocewei, PkmX, rkruppe, the_o, brucehoult, MartinMosbeck, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb.
Herald added a project: clang.

This follows the design as discussed on the mailing lists in the
following RFC: http://lists.llvm.org/pipermail/llvm-dev/2020-January/138364.html

Support for the vector 'v' extension v0.8.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81188

Files:
  clang/lib/Driver/ToolChains/Arch/RISCV.cpp
  clang/test/Driver/riscv-arch.c


Index: clang/test/Driver/riscv-arch.c
===================================================================
--- clang/test/Driver/riscv-arch.c
+++ clang/test/Driver/riscv-arch.c
@@ -360,3 +360,22 @@
 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-EXPERIMENTAL-ZBB-ZBP %s
 // RV32-EXPERIMENTAL-ZBB-ZBP: "-target-feature" "+experimental-zbb"
 // RV32-EXPERIMENTAL-ZBB-ZBP: "-target-feature" "+experimental-zbp"
+
+// RUN: %clang -target riscv32-unknown-elf -march=rv32iv -### %s \
+// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-EXPERIMENTAL-V-NOFLAG %s
+// RV32-EXPERIMENTAL-V-NOFLAG: error: invalid arch name 'rv32iv'
+// RV32-EXPERIMENTAL-V-NOFLAG: requires '-menable-experimental-extensions'
+
+// RUN: %clang -target riscv32-unknown-elf -march=rv32iv -menable-experimental-extensions -### %s \
+// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-EXPERIMENTAL-V-NOVERS %s
+// RV32-EXPERIMENTAL-V-NOVERS: error: invalid arch name 'rv32iv'
+// RV32-EXPERIMENTAL-V-NOVERS: experimental extension requires explicit version number
+
+// RUN: %clang -target riscv32-unknown-elf -march=rv32iv0p1 -menable-experimental-extensions -### %s \
+// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-EXPERIMENTAL-V-BADVERS %s
+// RV32-EXPERIMENTAL-V-BADVERS: error: invalid arch name 'rv32iv0p1'
+// RV32-EXPERIMENTAL-V-BADVERS: unsupported version number 0.1 for experimental extension
+
+// RUN: %clang -target riscv32-unknown-elf -march=rv32iv0p8 -menable-experimental-extensions -### %s \
+// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-EXPERIMENTAL-V-GOODVERS %s
+// RV32-EXPERIMENTAL-V-GOODVERS: "-target-feature" "+experimental-v"
Index: clang/lib/Driver/ToolChains/Arch/RISCV.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Arch/RISCV.cpp
+++ clang/lib/Driver/ToolChains/Arch/RISCV.cpp
@@ -62,6 +62,8 @@
       Ext == "zbf" || Ext == "zbm" || Ext == "zbp" || Ext == "zbr" ||
       Ext == "zbs" || Ext == "zbt" || Ext == "zbproposedc")
     return RISCVExtensionVersion{"0", "92"};
+  if (Ext == "v")
+    return RISCVExtensionVersion{"0", "8"};
   return None;
 }
 
@@ -399,6 +401,9 @@
     case 'b':
       Features.push_back("+experimental-b");
       break;
+    case 'v':
+      Features.push_back("+experimental-v");
+      break;
     }
 
     // Consume full extension name and version, including any optional '_'


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81188.268558.patch
Type: text/x-patch
Size: 2417 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200604/b6afe7ca/attachment-0001.bin>


More information about the cfe-commits mailing list