[PATCH] D105626: [RISCV][Clang] Add macro __riscv_zvlsseg for RVV Zvlsseg builtins

Jianjian Guan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 8 06:00:40 PDT 2021


jacquesguan created this revision.
jacquesguan added a reviewer: craig.topper.
Herald added subscribers: vkmr, frasercrmck, evandro, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb.
jacquesguan requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay.
Herald added a project: clang.

Add extension macro __riscv_zvlsseg to enable Zvlsseg builtins only with target feature Zvlsseg.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D105626

Files:
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vlseg.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vlsegff.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vlseg.c
  clang/utils/TableGen/RISCVVEmitter.cpp


Index: clang/utils/TableGen/RISCVVEmitter.cpp
===================================================================
--- clang/utils/TableGen/RISCVVEmitter.cpp
+++ clang/utils/TableGen/RISCVVEmitter.cpp
@@ -141,6 +141,7 @@
   D = 1 << 2,
   Zfh = 1 << 3,
   Zvamo = 1 << 4,
+  Zvlsseg = 1 << 5,
 };
 
 // TODO refactor RVVIntrinsic class design after support all intrinsic
@@ -784,6 +785,8 @@
   }
   if (RequiredExtension == "Zvamo")
     RISCVExtensions |= RISCVExtension::Zvamo;
+  if (RequiredExtension == "Zvlsseg")
+    RISCVExtensions |= RISCVExtension::Zvlsseg;
 
   // Init OutputType and InputTypes
   OutputType = OutInTypes[0];
@@ -1237,6 +1240,8 @@
     OS << LS << "defined(__riscv_zfh)";
   if (Extents & RISCVExtension::Zvamo)
     OS << LS << "defined(__riscv_zvamo)";
+  if (Extents & RISCVExtension::Zvlsseg)
+    OS << LS << "defined(__riscv_zvlsseg)";
   OS << "\n";
   return true;
 }
Index: clang/test/CodeGen/RISCV/rvv-intrinsics/vlseg.c
===================================================================
--- clang/test/CodeGen/RISCV/rvv-intrinsics/vlseg.c
+++ clang/test/CodeGen/RISCV/rvv-intrinsics/vlseg.c
@@ -2,12 +2,14 @@
 // REQUIRES: riscv-registered-target
 // RUN: %clang_cc1 -triple riscv32 -target-feature +f -target-feature +d \
 // RUN:   -target-feature +experimental-v -target-feature +experimental-zfh \
-// RUN:   -disable-O0-optnone -fallow-half-arguments-and-returns -emit-llvm %s \
-// RUN:   -o - | opt -S -mem2reg | FileCheck --check-prefix=CHECK-RV32 %s
+// RUN:   -target-feature +experimental-zvlsseg -disable-O0-optnone \
+// RUN:   -fallow-half-arguments-and-returns -emit-llvm %s -o - \
+// RUN:   | opt -S -mem2reg | FileCheck --check-prefix=CHECK-RV32 %s
 // RUN: %clang_cc1 -triple riscv64 -target-feature +f -target-feature +d \
 // RUN:   -target-feature +experimental-v -target-feature +experimental-zfh \
-// RUN:   -disable-O0-optnone -fallow-half-arguments-and-returns -emit-llvm %s \
-// RUN:   -o - | opt -S -mem2reg | FileCheck --check-prefix=CHECK-RV64 %s
+// RUN:   -target-feature +experimental-zvlsseg -disable-O0-optnone \
+// RUN:   -fallow-half-arguments-and-returns -emit-llvm %s -o - \
+// RUN:   | opt -S -mem2reg | FileCheck --check-prefix=CHECK-RV64 %s
 
 #include <riscv_vector.h>
 
Index: clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vlsegff.c
===================================================================
--- clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vlsegff.c
+++ clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vlsegff.c
@@ -2,12 +2,14 @@
 // REQUIRES: riscv-registered-target
 // RUN: %clang_cc1 -triple riscv32 -target-feature +f -target-feature +d \
 // RUN:   -target-feature +experimental-v -target-feature +experimental-zfh \
-// RUN:   -disable-O0-optnone -fallow-half-arguments-and-returns -emit-llvm %s \
-// RUN:   -o - | opt -S -mem2reg | FileCheck --check-prefix=CHECK-RV32 %s
+// RUN:   -target-feature +experimental-zvlsseg -disable-O0-optnone \
+// RUN:   -fallow-half-arguments-and-returns -emit-llvm %s -o - \
+// RUN:   | opt -S -mem2reg | FileCheck --check-prefix=CHECK-RV32 %s
 // RUN: %clang_cc1 -triple riscv64 -target-feature +f -target-feature +d \
 // RUN:   -target-feature +experimental-v -target-feature +experimental-zfh \
-// RUN:   -disable-O0-optnone -fallow-half-arguments-and-returns -emit-llvm %s \
-// RUN:   -o - | opt -S -mem2reg | FileCheck --check-prefix=CHECK-RV64 %s
+// RUN:   -target-feature +experimental-zvlsseg -disable-O0-optnone \
+// RUN:   -fallow-half-arguments-and-returns -emit-llvm %s -o - \
+// RUN:   | opt -S -mem2reg | FileCheck --check-prefix=CHECK-RV64 %s
 
 #include <riscv_vector.h>
 
Index: clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vlseg.c
===================================================================
--- clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vlseg.c
+++ clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vlseg.c
@@ -2,12 +2,14 @@
 // REQUIRES: riscv-registered-target
 // RUN: %clang_cc1 -triple riscv32 -target-feature +f -target-feature +d \
 // RUN:   -target-feature +experimental-v -target-feature +experimental-zfh \
-// RUN:   -disable-O0-optnone -fallow-half-arguments-and-returns -emit-llvm %s \
-// RUN:   -o - | opt -S -mem2reg | FileCheck --check-prefix=CHECK-RV32 %s
+// RUN:   -target-feature +experimental-zvlsseg -disable-O0-optnone \
+// RUN:   -fallow-half-arguments-and-returns -emit-llvm %s -o - \
+// RUN:   | opt -S -mem2reg | FileCheck --check-prefix=CHECK-RV32 %s
 // RUN: %clang_cc1 -triple riscv64 -target-feature +f -target-feature +d \
 // RUN:   -target-feature +experimental-v -target-feature +experimental-zfh \
-// RUN:   -disable-O0-optnone -fallow-half-arguments-and-returns -emit-llvm %s \
-// RUN:   -o - | opt -S -mem2reg | FileCheck --check-prefix=CHECK-RV64 %s
+// RUN:   -target-feature +experimental-zvlsseg -disable-O0-optnone \
+// RUN:   -fallow-half-arguments-and-returns -emit-llvm %s -o - \
+// RUN:   | opt -S -mem2reg | FileCheck --check-prefix=CHECK-RV64 %s
 
 #include <riscv_vector.h>
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105626.357201.patch
Type: text/x-patch
Size: 5038 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210708/4ae7677d/attachment-0001.bin>


More information about the cfe-commits mailing list