-
Notifications
You must be signed in to change notification settings - Fork 18
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 CORE-V headers #88
Conversation
Add header files for all CORE-V extensions that have C builtin functions. The definitions of existing builtin functions are also adjusted accordingly.
4341174
to
e1a8af0
Compare
|
||
#if defined(__riscv_xcvalu) | ||
|
||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__)) |
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.
This isn't a special symbol, so __DEFAULT_FN_ATTRS
does also need to be added to each declaration rather than just defined here.
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.
Each definition should also be static inline
(or, as appears to be the case for other targets' definitions, static __inline__
)
768675b
to
e0bf48a
Compare
…ons. This patch changes the C API headers that were added for the CORE-V ISA extensions so that they follow the standard described for RISC-V here: https://github.com/riscv-non-isa/riscv-c-api-doc/blob/master/riscv-c-api.md#intrinsic-functions The C API headers must provide a uniform interface for instrinsic functions that is compatible with any compiler that supports them. In the wrapper of a C API intrinsic function definition any compiler can implement the functionality differently, whether it is with an existing instrinsic function, or with inline assembly etc... The user code that adds a C API RISC-V header is agnostic to the implementation and is then compatible with any compiler that has the header. The RISC-V intrinsic functions have - the common prefix '__riscv_' to avoid name collision with other targets. - a vendor specific prefix if they belong to a vendor specific extension. - the name of the function. - the type of the function: this is typically used to distinguish different versions of the same intrinsic function that differ only for the type of one or more operands. Another convention is to use the type 'long' instead of integer types like int32_t or uint32_t as the type 'long' will be set to the current XLEN. According to these conventions the CORE-V intrinsic functions are now redefined like: long __riscv_cv_name_type(long op1, long op2) { return __builtin_riscv_cv_name_type(op1, op2); }
…t arguments. This patch adds macros in the C API header files instead of wrapped calls for those intrinsics which use const arguments. This change affects the intrinsics for: SIMD: - add_h - sub_h - cplxmul_r - cplxmul_i - subrotmj - shuffle_xhi - extract[u]_[h/b] - insert_[h/b] Bitmanip: - bitrev It also changes the type of the immediate argument of extract and shuffle.sci to const in the clang intrinsics definitions.
This is done to separate the tests for the internal implementation of the CORE-V intrinsics from the tests for C API interfaces of the same.
This is done to avoid multiple defines in the link step if the inlining fails.
Implemented in new patches. |
This is a reviewed version of the pull request #78