match.pd: Support combine cond_len_op + vec_cond similar to cond_op
commit711d703d07c8e9241361975674843cf0a3263f98
authorLehua Ding <lehua.ding@rivai.ai>
Tue, 19 Sep 2023 07:53:54 +0000 (19 15:53 +0800)
committerLehua Ding <lehua.ding@rivai.ai>
Tue, 31 Oct 2023 06:13:05 +0000 (31 14:13 +0800)
tree7c3440bb409f39aeffd70abcc1f9a2b3cb51c0c4
parent9cc2b97458b1bc4a3fa9b584f830f154b257f043
match.pd: Support combine cond_len_op + vec_cond similar to cond_op

This patch adds combine cond_len_op and vec_cond to cond_len_op like
cond_op.

Consider this code (RISC-V target):
  void
  foo (uint8_t *__restrict x, uint8_t *__restrict y, uint8_t *__restrict z,
       uint8_t *__restrict pred, uint8_t *__restrict merged, int n)
  {
    for (int i = 0; i < n; ++i)
      x[i] = pred[i] != 1 ? y[i] / z[i] : merged[i];
  }

Before this patch:
  ...
  vect_iftmp.18_71 = .COND_LEN_DIV (mask__31.11_61, vect__5.14_65, vect__7.17_69, { 0, ... }, _86, 0);
  vect_iftmp.23_78 = .VCOND_MASK (mask__31.11_61, vect_iftmp.18_71, vect_iftmp.22_77);
  ...

After this patch:
  ...
  _30 = .COND_LEN_DIV (mask__31.16_61, vect__5.19_65, vect__7.22_69, vect_iftmp.27_77, _85, 0);
  ...

gcc/ChangeLog:

* gimple-match.h (gimple_match_op::gimple_match_op):
Add interfaces for more arguments.
(gimple_match_op::set_op): Add interfaces for more arguments.
* match.pd: Add support of combining cond_len_op + vec_cond
gcc/gimple-match.h
gcc/match.pd