mirrored from git://gcc.gnu.org/git/gcc.git
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
arm: Auto-vectorization for MVE: vshr
This patch enables MVE vshr instructions for auto-vectorization. New MVE patterns are introduced that take a vector of constants as second operand, all constants being equal. The existing mve_vshrq_n_<supf><mode> is kept, as it takes a single immediate as second operand, and is used by arm_mve.h. The vashr<mode>3 and vlshr<mode>3 expanders are moved fron neon.md to vec-common.md, updated to rely on the normal expansion scheme to generate shifts by immediate. 2020-12-03 Christophe Lyon <christophe.lyon@linaro.org> gcc/ * config/arm/mve.md (mve_vshrq_n_s<mode>_imm): New entry. (mve_vshrq_n_u<mode>_imm): Likewise. * config/arm/neon.md (vashr<mode>3, vlshr<mode>3): Move to ... * config/arm/vec-common.md: ... here. gcc/testsuite/ * gcc.target/arm/simd/mve-vshr.c: Add tests for vshr.
- Loading branch information
Christophe Lyon
committed
Jan 15, 2021
1 parent
7432f25
commit bfab355
Showing
4 changed files
with
130 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* { dg-do assemble } */ | ||
/* { dg-require-effective-target arm_v8_1m_mve_ok } */ | ||
/* { dg-add-options arm_v8_1m_mve } */ | ||
/* { dg-additional-options "-O3" } */ | ||
|
||
#include <stdint.h> | ||
|
||
#define FUNC(SIGN, TYPE, BITS, NB, OP, NAME) \ | ||
void test_ ## NAME ##_ ## SIGN ## BITS ## x ## NB (TYPE##BITS##_t * __restrict__ dest, TYPE##BITS##_t *a, TYPE##BITS##_t *b) { \ | ||
int i; \ | ||
for (i=0; i<NB; i++) { \ | ||
dest[i] = a[i] OP b[i]; \ | ||
} \ | ||
} | ||
|
||
#define FUNC_IMM(SIGN, TYPE, BITS, NB, OP, NAME) \ | ||
void test_ ## NAME ##_ ## SIGN ## BITS ## x ## NB (TYPE##BITS##_t * __restrict__ dest, TYPE##BITS##_t *a) { \ | ||
int i; \ | ||
for (i=0; i<NB; i++) { \ | ||
dest[i] = a[i] OP 5; \ | ||
} \ | ||
} | ||
|
||
/* 64-bit vectors. */ | ||
FUNC(s, int, 32, 2, >>, vshr) | ||
FUNC(u, uint, 32, 2, >>, vshr) | ||
FUNC(s, int, 16, 4, >>, vshr) | ||
FUNC(u, uint, 16, 4, >>, vshr) | ||
FUNC(s, int, 8, 8, >>, vshr) | ||
FUNC(u, uint, 8, 8, >>, vshr) | ||
|
||
/* 128-bit vectors. */ | ||
FUNC(s, int, 32, 4, >>, vshr) | ||
FUNC(u, uint, 32, 4, >>, vshr) | ||
FUNC(s, int, 16, 8, >>, vshr) | ||
FUNC(u, uint, 16, 8, >>, vshr) | ||
FUNC(s, int, 8, 16, >>, vshr) | ||
FUNC(u, uint, 8, 16, >>, vshr) | ||
|
||
/* 64-bit vectors. */ | ||
FUNC_IMM(s, int, 32, 2, >>, vshrimm) | ||
FUNC_IMM(u, uint, 32, 2, >>, vshrimm) | ||
FUNC_IMM(s, int, 16, 4, >>, vshrimm) | ||
FUNC_IMM(u, uint, 16, 4, >>, vshrimm) | ||
FUNC_IMM(s, int, 8, 8, >>, vshrimm) | ||
FUNC_IMM(u, uint, 8, 8, >>, vshrimm) | ||
|
||
/* 128-bit vectors. */ | ||
FUNC_IMM(s, int, 32, 4, >>, vshrimm) | ||
FUNC_IMM(u, uint, 32, 4, >>, vshrimm) | ||
FUNC_IMM(s, int, 16, 8, >>, vshrimm) | ||
FUNC_IMM(u, uint, 16, 8, >>, vshrimm) | ||
FUNC_IMM(s, int, 8, 16, >>, vshrimm) | ||
FUNC_IMM(u, uint, 8, 16, >>, vshrimm) | ||
|
||
/* MVE has only 128-bit vectors, so we can vectorize only half of the | ||
functions above. */ | ||
/* { dg-final { scan-assembler-times {vshr.s[0-9]+\tq[0-9]+, q[0-9]+} 3 } } */ | ||
/* { dg-final { scan-assembler-times {vshr.u[0-9]+\tq[0-9]+, q[0-9]+} 3 } } */ |