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

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

https://gcc.gnu.org/g:a767a6a5609e0d0850291e2a035a8c71e9b14074

commit r17-3307-ga767a6a5609e0d0850291e2a035a8c71e9b14074
Author: Odysseas Georgoudis <[email protected]>
Date:   Wed Jul 22 21:47:56 2026 +0100

    i386: Canonicalize PAVG builtins to IFN_AVG_CEIL [PR122715]

    PAVG builtins use signed vector types even though the instruction
    computes an unsigned average rounded up.  View-convert the operands
    to unsigned vector types and canonicalize unmasked and all-ones
    masked calls to IFN_AVG_CEIL.  This exposes the calls to generic
    simplifications while preserving masks with inactive lanes.

    For modes without an IFN_AVG_CEIL optab, canonicalize only when
    equal operands allow the internal function to simplify immediately.

            PR middle-end/122715

    gcc/ChangeLog:

            * config/i386/i386.cc: Include "internal-fn.h".
            (ix86_gimple_fold_builtin): Canonicalize PAVG builtins to
            IFN_AVG_CEIL.

    gcc/testsuite/ChangeLog:

            * gcc.target/i386/pr122715.c: New test.
            * gcc.target/i386/pr122715-2.c: New test.

Reply via email to