https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128670

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Uros Bizjak <[email protected]>:

https://gcc.gnu.org/g:050413681696ce80483e183d59e5580ec74b73ec

commit r17-6319-g050413681696ce80483e183d59e5580ec74b73ec
Author: Uros Bizjak <[email protected]>
Date:   Mon Nov 16 09:04:28 2026 +0100

    i386: Classify each element of an array per the psABI [PR128670]

    The x86-64 psABI classifies an aggregate by classifying each of its
    fields, and thus each array element, recursively and merging the classes
    of the fields sharing an eightbyte.  Zero-width bit-fields are NO_CLASS.

    classify_argument classified only the first element of an array and
    replicated its classes over the eightbytes of the array.  This is exact
    only when the element size is a multiple of a word.  For an element like
    struct { char x; int : 0; } at an odd offset, the classes of the first
    element are { INTEGER, NO_CLASS }, so the eightbyte that holds the
    second element is classified as NO_CLASS and its data is not returned in
    a register.  Replicating also gives a wrong partial class when the first
    element does not use a whole eightbyte that other elements use, e.g. an
    SSEHF class for an eightbyte that holds 8 bytes of _Float16 data.

    Classify each element of an array at its actual offset and merge the
    classes of the elements sharing an eightbyte.  The promotion of partial
    classes is applied to the first class of each element, so that the
    classification of arrays that were classified correctly is unchanged.
    Arrays larger than two eightbytes with more than one element are always
    passed in memory, so return early for them.  A zero-sized array is
    classified by classifying one element, as before.

    Assisted-by: Claude Sonnet 5.5

            PR target/128670

    gcc/ChangeLog:

            * config/i386/i386.cc (classify_argument) <case ARRAY_TYPE>:
            Classify each element at its actual offset and merge the classes
            of the elements.

    gcc/testsuite/ChangeLog:

            * gcc.target/i386/pr128670.c: New test.

Reply via email to