RISC-V: Implement riscv_minimal_hwprobe_feature_bits
This patch implements the riscv_minimal_hwprobe_feature_bits feature
for the RISC-V target. The feature bits are defined in the
libgcc/config/riscv/feature_bits.c to provide bitmasks of ISA extensions
that defined in RISC-V C-API. Thus, we need a function to generate the
feature bits for IFUNC resolver to dispatch between different functions
based on the hardware features.
The minimal feature bits means to use the earliest extension appeard in
the Linux hwprobe to cover the given ISA string. To allow older kernels
without some implied extensions probe to run the FMV dispatcher
correctly.
For example, V implies Zve32x, but Zve32x appears in the Linux kernel
since v6.11. If we use isa string directly to generate FMV dispatcher
with functions with "arch=+v" extension, since we have V implied the
Zve32x, FMV dispatcher will check if the Zve32x extension is supported
by the host. If the Linux kernel is older than v6.11, the FMV dispatcher
will fail to detect the Zve32x extension even it already implies by the
V extension, thus making the FMV dispatcher fail to dispatch the correct
function.
Thus, we need to generate the minimal feature bits to cover the given
ISA string to allow the FMV dispatcher to work correctly on older
kernels.
Signed-off-by:
Yangyu Chen <cyy@cyyself.name>
gcc/ChangeLog:
* common/config/riscv/riscv-common.cc
(RISCV_EXT_BITMASK): New macro.
(struct riscv_ext_bitmask_table_t): New struct.
(riscv_minimal_hwprobe_feature_bits): New function.
* common/config/riscv/riscv-ext-bitmask.def: New file.
* config/riscv/riscv-subset.h (GCC_RISCV_SUBSET_H): Include
riscv-feature-bits.h.
(riscv_minimal_hwprobe_feature_bits): Declare the function.
* config/riscv/riscv-feature-bits.h: New file.
Showing
- gcc/common/config/riscv/riscv-common.cc 94 additions, 0 deletionsgcc/common/config/riscv/riscv-common.cc
- gcc/common/config/riscv/riscv-ext-bitmask.def 83 additions, 0 deletionsgcc/common/config/riscv/riscv-ext-bitmask.def
- gcc/config/riscv/riscv-feature-bits.h 44 additions, 0 deletionsgcc/config/riscv/riscv-feature-bits.h
- gcc/config/riscv/riscv-subset.h 5 additions, 0 deletionsgcc/config/riscv/riscv-subset.h
Loading
Please register or sign in to comment