]> git.ipfire.org Git - thirdparty/gcc.git/commit
autovectorizer: Test autovectorization of different dot-prod modes.
authorVictor Do Nascimento <victor.donascimento@arm.com>
Fri, 5 Jul 2024 14:18:32 +0000 (15:18 +0100)
committerVictor Do Nascimento <victor.donascimento@arm.com>
Mon, 30 Sep 2024 14:59:43 +0000 (15:59 +0100)
commit8398ef96cc503cffb1447c5b02741e24423ec120
tree9d208c944a8ed582e229a25c9804925b036e496e
parentfd35d99914051c9c58b91b167f4802c8db460038
autovectorizer: Test autovectorization of different dot-prod modes.

Given the novel treatment of the dot product optab as a conversion, we
are now able to target different relationships between output modes and
input modes.

This is made clearer by way of example. Previously, on AArch64, the
following loop was vectorizable:

uint32_t udot4(int n, uint8_t* data) {
  uint32_t sum = 0;
  for (int i=0; i<n; i+=1)
    sum += data[i] * data[i];
  return sum;
}

while the following was not:

uint32_t udot2(int n, uint16_t* data) {
  uint32_t sum = 0;
  for (int i=0; i<n; i+=1)
    sum += data[i] * data[i];
  return sum;
}

Under the new treatment of the dot product optab, they are both now
vectorizable.

This adds the relevant target-agnostic check to ensure this behavior
in the autovectorizer, gated behind the new check_effective_target
`vect_dotprod_hisi' as well a runtime check targeting aarch64.

gcc/testsuite/ChangeLog:

* lib/target-supports.exp (check_effective_target_vect_dotprod_hisi):
New.
* gcc.dg/vect/vect-dotprod-conv-optab.c: Likewise.
* gcc.target/aarch64/vect-dotprod-twoway-hisi.c: Likewise.
gcc/testsuite/gcc.dg/vect/vect-dotprod-conv-optab.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/vect-dotprod-twoway-hisi.c [new file with mode: 0644]
gcc/testsuite/lib/target-supports.exp