]> gcc.gnu.org Git - gcc.git/commit
VECT: Add vec_mask_len_{load_lanes,store_lanes} patterns
authorJuzhe-Zhong <juzhe.zhong@rivai.ai>
Fri, 11 Aug 2023 06:49:10 +0000 (14:49 +0800)
committerJeff Law <jlaw@ventanamicro.com>
Thu, 17 Aug 2023 14:55:16 +0000 (08:55 -0600)
commit1ab04ca3591c844127f9de0f57651bc26ce074e6
treea033fdccda543bab8311f22dd8610801f2777044
parent3432b628fb63d068052646bc474b4960ad684fe9
VECT: Add vec_mask_len_{load_lanes,store_lanes} patterns

This patch is add vec_mask_len_{load_lanes,store_stores} autovectorization patterns.

Here we want to support this following autovectorization:

void
foo (int8_t *__restrict a,
int8_t *__restrict b,
int8_t *__restrict cond,
int n)
{
  for (intptr_t i = 0; i < n; ++i)
    {
      if (cond[i])
        a[i] = b[i * 2] + b[i * 2 + 1];
    }
}

ARM SVE IR:

https://godbolt.org/z/cro1Eqc6a

  # loop_mask_60 = PHI <next_mask_82(4), max_mask_81(3)>
  ...
  mask__39.12_63 = vect__3.11_61 != { 0, ... };
  vec_mask_and_66 = loop_mask_60 & mask__39.12_63;
  ...
  vect_array.15 = .MASK_LOAD_LANES (_57, 8B, vec_mask_and_66);
  ...

For RVV, we would like to see IR:

  loop_len = SELECT_VL;
  ...
  mask__39.12_63 = vect__3.11_61 != { 0, ... };
  ...
  vect_array.15 = .MASK_LEN_LOAD_LANES (_57, 8B, mask__39.12_63, loop_len, bias);
  ...

Bootstrap and Regression on X86 passed.

Ok for trunk ?

gcc/ChangeLog:

* doc/md.texi: Add vec_mask_len_{load_lanes,store_lanes} patterns.
* internal-fn.cc (expand_partial_load_optab_fn): Ditto.
(expand_partial_store_optab_fn): Ditto.
* internal-fn.def (MASK_LEN_LOAD_LANES): Ditto.
(MASK_LEN_STORE_LANES): Ditto.
* optabs.def (OPTAB_CD): Ditto.

(cherry picked from commit 59d789b34810d43ddba734e4adb80c29c210e49c)
gcc/doc/md.texi
gcc/internal-fn.cc
gcc/internal-fn.def
gcc/optabs.def
This page took 0.056544 seconds and 5 git commands to generate.