]> git.ipfire.org Git - thirdparty/gcc.git/commit
match: Fix vcond into conditional op folding [PR113607].
authorRobin Dapp <rdapp@ventanamicro.com>
Tue, 30 Jan 2024 17:39:08 +0000 (18:39 +0100)
committerRobin Dapp <rdapp@ventanamicro.com>
Wed, 31 Jan 2024 20:29:40 +0000 (21:29 +0100)
commit8123f3ca3fd891034a8366518e756f161c4ff40d
tree0296fe5b251df4b31fa4ec5c854691df7892a429
parentd836db149d439658cb98688f3f5c6ed58446e333
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.
gcc/match.pd
gcc/testsuite/gcc.target/aarch64/sve/pre_cond_share_1.c
gcc/testsuite/gcc.target/riscv/rvv/autovec/pr113607-run.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/rvv/autovec/pr113607.c [new file with mode: 0644]