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.

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.

Attachment: PR122715.patch
Description: PR122715.patch

Reply via email to