-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C Compiler Builtins for CSR Accesses #8
Comments
Instead of |
IIRC we've discuss that once on LLVM sync up meeting, there is concern for those intrinsic, the code might compile-able when optimization enabled (e.g. compile with -O1 or higher) but not compile-able when optimization disabled, because the CSR number must be integer literal. For example, following code is OK if you compile with -O1, but compiler will complain if you compile with -O0.
Those CSR intrinsic having similar issue as the above example, but there is svget* and svset* in ACLE for SVE, which can emit error when the input isn't constant, so I think it should not be a problem now. Example from ACLE:
Diagnostics message from clang and GCC.
So basically I am OK with those CSR intrinsic now, but just remind that we need to carefully to implement and test to make sure the argument must be constant integer. |
Yeah I recall something like this. I would support the aliased versions being implemented as macros, rather than functions, if that suggestion is any help. |
Ages ago, I proposed a Clang patch to add builtins for CSR accesses, so that there would be less reliance on inline assembly. I intended to finish that patch, and then make a proposal here, but I have not managed to do so.
The patch is here: https://reviews.llvm.org/D71778
It proposes:
Which correspond to
csrrw
,csrrs
andcsrrc
respectively (and took a CSR ID as the first argument, which had to be an immediate).Is this useful? What do people think? I think I was also going to propose nicer names for these in
rvintrin.h
, maybe including equivalents for the pseudo-instructions, but I don't recall all of my intentions from back then any more.The text was updated successfully, but these errors were encountered: