mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-27 05:44:15 +08:00
ca44eb7f6a
This provides a common abstraction layer to probe the available extensions at run-time. These functions can be used to implement function multi-versioning or to detect available extensions. The advantages of providing this abstraction layer are: - Easy to port to other new platforms. - Easier to maintain in GCC for function multi-versioning. - For example, maintaining platform-dependent code in C code/libgcc is much easier than maintaining it in GCC by creating GIMPLEs... This API is intended to provide the capability to query minimal common available extensions on the system. The API is defined in the riscv-c-api-doc: https://github.com/riscv-non-isa/riscv-c-api-doc/blob/main/src/c-api.adoc Proposal to use unsigned long long for marchid and mimpid: https://github.com/riscv-non-isa/riscv-c-api-doc/pull/91 Full function multi-versioning implementation will come later. We are posting this first because we intend to backport it to the GCC 14 branch to unblock LLVM 19 to use this with GCC 14.2, rather than waiting for GCC 15. Changes since v7: - Remove vendorID field in __riscv_vendor_feature_bits. - Fix C implies Zcf only for RV32. - Add more comments to kernel versions. Changes since v6: - Implement __riscv_cpu_model. - Set new sub extension bits which implied from previous extensions. Changes since v5: - Minor fixes on indentation. Changes since v4: - Bump to newest riscv-c-api-doc with some new extensions like Zve*, Zc* Zimop, Zcmop, Zawrs. - Rename the return variable name of hwprobe syscall. - Minor fixes on indentation. Changes since v3: - Fix non-linux build. - Let __init_riscv_feature_bits become constructor Changes since v2: - Prevent it initialize more than once. Changes since v1: - Fix the format. - Prevented race conditions by introducing a local variable to avoid load/store operations during the computation of the feature bit. Co-Developed-by: Yangyu Chen <chenyangyu@isrc.iscas.ac.cn> Signed-off-by: Yangyu Chen <chenyangyu@isrc.iscas.ac.cn> libgcc/ChangeLog: * config/riscv/feature_bits.c: New. * config/riscv/t-elf (LIB2ADD): Add feature_bits.c.
10 lines
378 B
Plaintext
10 lines
378 B
Plaintext
LIB2ADD += $(srcdir)/config/riscv/save-restore.S \
|
|
$(srcdir)/config/riscv/muldi3.S \
|
|
$(srcdir)/config/riscv/multi3.c \
|
|
$(srcdir)/config/riscv/div.S \
|
|
$(srcdir)/config/riscv/atomic.c \
|
|
$(srcdir)/config/riscv/feature_bits.c \
|
|
|
|
# Avoid the full unwinder being pulled along with the division libcalls.
|
|
LIB2_DIVMOD_EXCEPTION_FLAGS := -fasynchronous-unwind-tables
|