diff options
author | Jennifer Schmitz <jschmitz@nvidia.com> | 2024-10-15 07:58:14 -0700 |
---|---|---|
committer | Jennifer Schmitz <jschmitz@nvidia.com> | 2024-10-24 09:02:53 +0200 |
commit | 90e38c4ffad086a82635e8ea9bf0e7e9e02f1ff7 (patch) | |
tree | 37aed80308c86aab71b606ba3e4650886598ad26 /gcc/fortran | |
parent | 078f7c4f1fcf4d7099d855afb02dbaf71bebddbf (diff) | |
download | gcc-90e38c4ffad086a82635e8ea9bf0e7e9e02f1ff7.zip gcc-90e38c4ffad086a82635e8ea9bf0e7e9e02f1ff7.tar.gz gcc-90e38c4ffad086a82635e8ea9bf0e7e9e02f1ff7.tar.bz2 |
SVE intrinsics: Add constant folding for svindex.
This patch folds svindex with constant arguments into a vector series.
We implemented this in svindex_impl::fold using the function build_vec_series.
For example,
svuint64_t f1 ()
{
return svindex_u642 (10, 3);
}
compiled with -O2 -march=armv8.2-a+sve, is folded to {10, 13, 16, ...}
in the gimple pass lower.
This optimization benefits cases where svindex is used in combination with
other gimple-level optimizations.
For example,
svuint64_t f2 ()
{
return svmul_x (svptrue_b64 (), svindex_u64 (10, 3), 5);
}
has previously been compiled to
f2:
index z0.d, #10, #3
mul z0.d, z0.d, #5
ret
Now, it is compiled to
f2:
mov x0, 50
index z0.d, x0, #15
ret
We added test cases checking
- the application of the transform during gimple for constant arguments,
- the interaction with another gimple-level optimization.
The patch was bootstrapped and regtested on aarch64-linux-gnu, no regression.
OK for mainline?
Signed-off-by: Jennifer Schmitz <jschmitz@nvidia.com>
gcc/
* config/aarch64/aarch64-sve-builtins-base.cc
(svindex_impl::fold): Add constant folding.
gcc/testsuite/
* gcc.target/aarch64/sve/index_const_fold.c: New test.
Diffstat (limited to 'gcc/fortran')
0 files changed, 0 insertions, 0 deletions