[clang] [llvm] [RISC-V] Add CSR read/write builtins (PR #85091)
Nemanja Ivanovic via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 14 14:10:01 PDT 2024
nemanjai wrote:
> You can just use `({ ... })` to achieve that same goal with inline assembly (and write doesn't even need that, you can do it with a single statement). I'm not convinced the intrinsics gain you anything.
Hmm... I think there's a bit of a disconnect here between the point I am trying to make and your responses. I have attempted to illustrate that this is meant as a **usability** enhancement. Not something that will increase the expressive power of the language. Any usability feature, more or less by nature, can be achieved in **another way**. Whatever usability enhancement one proposes, there can always be a rebuttal suggesting that the **semantics** can be achieved through some other mechanism. Sometimes that mechanism is an exotic one such as GNU statement expressions.
I view the compiler as a tool that users use to achieve the goal of developing and building their project and its usability has a direct contribution to the users' ability to effectively achieve their goal. If a tool can easily provide a convenient and consistent mechanism to achieve a specific goal without significant drawbacks, it should probably do so.
Suggesting that a facility the compiler can easily provide can be achieved with something like a GNU statement expression, in my opinion is in direct opposition to the goal of improving the usability of the compiler. Calls to functions/intrinsics are a fundamental aspect of a language such as C/C++ that everyone is familiar with. GNU statement expressions exist in an entirely different realm and are familiar to an exceedingly small subset of developers.
I feel that the argument of "you don't need this, you can achieve it in another way" is only meaningful if "this" has significant drawbacks or if "another way" is equivalently convenient. As an absurd example that regresses this argument to the absolute extreme, one could state that "you don't need a compiler or high level language, you can just write your code in assembly." I am of course not making any attempt to draw a false equivalence between your suggestion and that absurd example. I am simply illustrating the point that not every way of achieving a goal is equivalent in terms of skill and effort required to achieve it.
I am sorry to digress into a philosophical discussion in this post, but I feel like our discussion is not converging as we are making somewhat orthogonal arguments.
So can we please discuss the way forward based on whether we feel this usability enhancement is desirable and whether its benefits outweigh the cost of providing it. What is not at all clear to me is what you view as the cost of providing this convenience. And to a lesser extent whether you feel that a familiar interface such as a builtin would at all be preferrable to any user.
https://github.com/llvm/llvm-project/pull/85091
More information about the cfe-commits
mailing list