GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
internal-fn

internal-fn: Record argument counts for direct internal functions

Enables validation of argument counts for direct internal functions.

This patch enhances the information stored for direct internal functions by recording the minimum and maximum number of expected arguments. This allows for more robust validation of internal function calls, preventing errors where expanders expect a certain number of arguments but receive a different count. New TYPEs are introduced for variations like masked loads/stores to correctly associate argument counts. This change also asserts that calls have a valid number of arguments.

In Details

The direct_internal_fn_info structure in internal-fn.h is extended to include nargs_min and nargs_max fields. These are populated in the direct_internal_fn_info initializers for various internal functions. A new helper function direct_internal_fn_nargs_ok_p is introduced to check these counts. The vectorizable field is resized to accommodate these new counts. This change enables verification of the number of arguments passed to direct internal functions, catching errors related to argument counts which were previously only detected by expanders.

For Context
Direct Internal Function
A type of internal function in GCC that has a direct mapping to a specific operation or intrinsic, often with a fixed set of arguments.
Expander
A piece of code within the compiler that translates an intermediate representation (like GIMPLE) into lower-level instructions or optimized forms.
Vectorizer
A compiler pass that attempts to transform scalar code into vector (SIMD) code to improve performance on multi-core processors.
GIMPLE
GCC's internal three-assignment representation, an intermediate language used for optimization.
Filed Under: internal-fncompilervalidation