[PATCH] D141032: [Clang][RISCV] Expose vlenb to user

Yueh-Ting (eop) Chen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 8 10:01:47 PST 2023


eopXD marked 2 inline comments as done.
eopXD added inline comments.


================
Comment at: clang/include/clang/Basic/riscv_vector.td:1565
+  unsigned long __rv = 0;
+  __asm__ __volatile__ ("csrr\t%0, vlenb" : "=r"(__rv) : : "memory");
+  return __rv;
----------------
pcwang-thead wrote:
> Inline assembly may not be elegant since it can't be optimized in many ways. We can eliminate some redundant reads of vlenb currently(done in D125564). So I think we may add a builtin function and lower it to `llvm.read_register`?
Thank you for the tip. Please review.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141032



More information about the cfe-commits mailing list