-
Notifications
You must be signed in to change notification settings - Fork 42
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
Add riscv_int.h and define int_xlen_t and uint_xlen_t #14
base: main
Are you sure you want to change the base?
Conversation
The B extension proposal calls for a rvintrin.h file. The B extension is proposing that there is that we have a single intrinsic header file for riscv, though given the size of the V extension, I'm not sure if it is a good idea to force people to include the V support when they don't want it. Maybe put each extension in its own file, and then include it in the master (rvintrin.h?) file, maybe only if the appropriate extension is enabled. I don't care about the type names. People have asked for this feature before, so adding the types is useful. It isn't obvious what the MIN MAX macros are for, or how the types can hvae min/max sizes. |
@jim-wilson I think the macros are meant to be the natural extensions of ones in I wonder if it's worth specifying that |
My brain was stuck on type sizes, which don't have min and mix, but min and max representable values makes perfect sense. |
While we're at it, there's also the |
Oh, maybe my word not clear enough, but I intend to do that, e.g. only included V-ext intrinsic when V or zv* extensions is enabled.
|
@knightsifive thanks, in fact I was refer to the same page before :P |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
I think there are two issues to resolve/decide to land this:
I want to avoid these types being gated by a header file with the name "intrinsic" in it. Intrinsics are just some use cases. So I am for either nothing or If namespace pollution is a concern, then I am also ok with a name like I also agree about creating a complete set of support macros. However, we should drop |
I just narrow down the scope of this PR, and made this specific to adding xlen-integer type only, also add print/scan modifier macros. Also rename the file to riscv_int.h and adding prefix |
@kito-cheng, do you have a particular use case for these types? Last time we discussed this (I raised the topic in the Toolchain SIG call), we only identified shared code for RV32/RV64 that accesses CSRs as a potential candidate. But that could be solved differently as well and would not really justify the introduction of a new type. Therefore, we deferred this topic back then. |
@cmuellner I guess I didn't give the context why I restart that again, the reason I restart is because @topperc is working on scalar intrinsic like #44, we discuss some of intrinsic other than scalar crypto might need xlen type, but LLVM implementation: https://reviews.llvm.org/D154706 |
Changes:
|
I'm not convinced of the need for this. I don't see a strong use case of writing xlen aware bitmanipulation code. Some crypto algorithms need to be different for RV32 and RV64, but once you've done that you know what xlen is and can use the 32/64 bitmanip intrinsics directly as needed. |
This PR is the product of this RFC[1], the main purpose is provide a pair of integer type with XLEN-bits.
According the discussion, many people are concern about we should not add the type directly, that will corrupt the global namespace, so it would be great if we put it in the header files.
So why it put in
riscv_intrinsic.h
? here is two reason, first reason is the initial request are come from intrinsic function interface, so put they together should be reasonable, second reason is I have no idea which file name is the best :Priscv.h
is little bit too generic and sounds like easy to conflict with exist headers - as I know at least gcc, binutils and gdb has one.[1] riscv-non-isa/riscv-elf-psabi-doc#158