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

Hsiangkai Wang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 4 19:51:39 PDT 2020


HsiangKai updated this revision to Diff 268642.
HsiangKai added a comment.

Address @MaskRay's comments.


Repository:
  rG LLVM Github Monorepo

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

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 -c 2>&1 | \
+// RUN:   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 -c 2>&1 | \
+// RUN:   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 -c 2>&1 | \
+// RUN:   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 -c 2>&1 | \
+// RUN:   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.268642.patch
Type: text/x-patch
Size: 2381 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200605/762abc5a/attachment.bin>


More information about the cfe-commits mailing list