GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
i386 Performance Win

i386: Classify array elements correctly per psABI

Fixes incorrect classification of array elements in x86-64 function calls, ensuring proper register allocation and data transfer.

This commit corrects how array elements are classified for the x86-64 calling convention. Previously, GCC only classified the first element of an array and replicated its classification, which could lead to incorrect register allocation or data transfer when element sizes were not multiples of word sizes or when elements straddled eight-byte boundaries. The fix now classifies each array element at its actual offset and merges classifications for elements within the same eight-byte word, improving accuracy for complex array types.

In Details

The x86-64 psABI dictates that aggregates, including arrays, are classified by recursively classifying their fields. This change refines classify_argument in i386.cc to correctly handle array elements, especially those with non-standard sizes or padding, by iterating through each element and merging their classifications within eightbyte chunks. This addresses issues with PR128452 where incorrect partial class promotions and zero-width bit-fields led to suboptimal or erroneous register usage.

Filed Under: x86-64abicalling conventioncompiler