-
Notifications
You must be signed in to change notification settings - Fork 88
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
Use fixed-width integer type instead of long? #31
Comments
I saw there is similar request in several intrinsic design, including P-extension and B-extension, maybe we should add that into psabi? |
FYI: this discussion was moved to riscv-non-isa/riscv-elf-psabi-doc#158. |
We're working on upstreaming the rvv intrinsics to llvm/clang. I'm trying to figure out if this is an issue we should worry about for that. I need to define builtins for vsetvl and all the intrinsics that take a vl operand. clang's system for specifying builtins mostly uses fixed types. There are currently a few special cases, for example saying a builtin needs a 64 bit type where will choose long or long long depending on which is really 64 bits. There's also a special case to say a builtin takes size_t. There isn't any target specific overrides into that code today so I don't have a way of saying a builtin takes an xlen integer and I'm not sure how to abstract it into target independent code. Maybe I can have it find the same type as attribute ((mode (word)))? Another option might be to just say that vl is a 32-bit "unsigned" in the C interface? Greater than 4 billion element vectors seems like a lot. |
My advice is the following:
|
We have existing proposal in riscv-c-api-doc #14 that is still pending. I understand the fastest way here is to define the types in the RVV intrinsic header, but the formal completion should allow multiple extensions to use this defined type. This issue will be held and resolved after v1.0 since it is depending on more consensus in the RISC-V community. |
In a number of places, the V-extension intrinsics API uses
long
orunsigned long
to represent an XLEN-bit integer (signed or unsigned, resp.). It's true thatlong
has size XLEN in the currently defined ILP32 and LP64 ABIshttps://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md#-named-abis
However, note that
And one can imagine a similar scenario for RV128. Hence, I think it's preferable to future-proof the intrinsics API by using typedefs [Footnote 1]. I don't think this adds much notational overhead.
Please note that we had the same discussion for the P-extension intrinsics, and arrived at the same conclusion
https://lists.riscv.org/g/tech-p-ext/topic/73148653#26
[Footnote 1]
On GCC and Clang/LLVM, you can alias the relevant types as follows:
Those who enjoy preprocessor wizardry might prefer something like
The text was updated successfully, but these errors were encountered: