GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
risc-v

RISC-V: Add C API feature bits for existing extensions.

Adds missing C API feature bits for existing RISC-V extensions, improving feature detection.

This commit adds missing C API feature bits for existing RISC-V extensions, including b, e, h, zilsd, zclsd, zcmp, zifencei, and zmmul. These extensions were already present in riscv-ext.def, but the corresponding bitmask table and libgcc definitions were missing. This addition ensures that the compiler can properly detect and utilize these extensions, resolving inconsistencies and improving feature support.

In Details

The RISC-V C API relies on feature bits for detecting extensions. While GCC's riscv-ext.def already included several extensions (b, e, h, zilsd, zclsd, zcmp, zifencei, and zmmul), the corresponding feature bit metadata in riscv-ext-bitmask.def and libgcc was incomplete. This patch rectifies this by adding the missing bit definitions, allowing GCC to accurately identify these extensions during compilation and runtime.

For Context

RISC-V CPUs often include optional extensions to the core instruction set. To use these extensions effectively, the compiler needs to know which ones are present. This commit adds metadata to GCC to indicate the presence of several existing RISC-V extensions. This ensures that the compiler can correctly detect and utilize these extensions when generating code, potentially leading to improved performance and access to new features.

Filed Under: risc-vfeature detectionmetadata