https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113607
--- Comment #24 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Robin Dapp <rd...@gcc.gnu.org>: https://gcc.gnu.org/g:8123f3ca3fd891034a8366518e756f161c4ff40d commit r14-8668-g8123f3ca3fd891034a8366518e756f161c4ff40d Author: Robin Dapp <rd...@ventanamicro.com> Date: Tue Jan 30 18:39:08 2024 +0100 match: Fix vcond into conditional op folding [PR113607]. In PR113607 we see an invalid fold of _429 = .COND_SHL (mask_patt_205.47_276, vect_cst__262, vect_cst__262, { 0, ... }); vect_prephitmp_129.51_282 = _429; vect_iftmp.55_287 = VEC_COND_EXPR <mask_patt_209.54_286, vect_prephitmp_129.51_282, vect_cst__262>; to Applying pattern match.pd:9607, gimple-match-10.cc:3817 gimple_simplified to vect_iftmp.55_287 = .COND_SHL (mask_patt_205.47_276, vect_cst__262, vect_cst__262, { 0, ... }); where we essentially use COND_SHL's else instead of VEC_COND_EXPR's. This patch adjusts the corresponding match.pd pattern and makes it only match when the else values are the same. That, however, causes the exact test case for which this pattern was introduced for to fail. Therefore XFAIL it for now. gcc/ChangeLog: PR middle-end/113607 * match.pd: Make sure else values match when folding a vec_cond into a conditional operation. gcc/testsuite/ChangeLog: * gcc.target/aarch64/sve/pre_cond_share_1.c: XFAIL. * gcc.target/riscv/rvv/autovec/pr113607-run.c: New test. * gcc.target/riscv/rvv/autovec/pr113607.c: New test.