On Wed, Jul 15, 2026 at 7:43 AM Odysseas Georgoudis <[email protected]> wrote: > > This patch fixes PR middle-end/122715 by folding IFN_AVG_FLOOR (x, x) and > IFN_AVG_CEIL (x, x) to x. > > x86 PAVG intrinsics are represented by target builtins instead of > IFN_AVG_CEIL. The patch therefore also folds calls with equal operands in > ix86_gimple_fold_builtin. For masked forms, the fold is applied only when > every lane is enabled by the mask.
The match.pd / gimple testcase part is OK. Please split the x86 target part to a separate patch (we might want to instead fold the target builtin to the internal function call?) Thanks, Richard. > Bootstrapped on x86_64-pc-linux-gnu. The new tests and the existing PAVG > focused tests pass. The target-independent match.pd fold was also tested > using an AArch64 cross-compiler.
