[PATCH] D125765: [RISCV] Add type aliases float16_t, float32_t and float64_t

Wang Pengcheng via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 17 05:02:14 PDT 2022


pcwang-thead created this revision.
pcwang-thead added reviewers: asb, luismarques, kito-cheng, craig.topper.
Herald added subscribers: sunshaoce, VincentWu, luke957, jeroen.dobbelaere, StephenFan, vkmr, frasercrmck, evandro, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, niosHD, sabuasal, simoncook, johnrusso, rbar, arichardson.
Herald added a project: All.
pcwang-thead requested review of this revision.
Herald added subscribers: cfe-commits, eopXD.
Herald added a project: clang.

We use them in RVV intrinsics doc but there is no definition
in riscv_vector.h, which is confusing for users. This matches
what GCC does too.

There are too many tests using the raw types, so we keep them
untouched.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D125765

Files:
  clang/include/clang/Basic/riscv_vector.td


Index: clang/include/clang/Basic/riscv_vector.td
===================================================================
--- clang/include/clang/Basic/riscv_vector.td
+++ clang/include/clang/Basic/riscv_vector.td
@@ -1504,6 +1504,16 @@
 // and LMUL.
 let HeaderCode =
 [{
+#if defined(__riscv_zvfh)
+typedef _Float16 float16_t;
+#endif
+#if defined(__riscv_f)
+typedef float float32_t;
+#endif
+#if defined(__riscv_d)
+typedef double float64_t;
+#endif
+
 #define vsetvl_e8mf8(avl) __builtin_rvv_vsetvli((size_t)(avl), 0, 5)
 #define vsetvl_e8mf4(avl) __builtin_rvv_vsetvli((size_t)(avl), 0, 6)
 #define vsetvl_e8mf2(avl) __builtin_rvv_vsetvli((size_t)(avl), 0, 7)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125765.430001.patch
Type: text/x-patch
Size: 661 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220517/a368b0f4/attachment.bin>


More information about the cfe-commits mailing list