diff options
author | Andre Vieira <andre.simoesdiasvieira@arm.com> | 2023-11-03 19:09:07 +0000 |
---|---|---|
committer | Andre Vieira <andre.simoesdiasvieira@arm.com> | 2023-11-03 19:09:07 +0000 |
commit | aed00696a01ac065e9ed327434ec29d1cf50179e (patch) | |
tree | 0a57b9a8842e77c3acd4667607f9c31f1721e694 /gcc/tree-vect-stmts.cc | |
parent | ae8abcb81ed81456c0fe5ff8e0c060c9fb9c82d7 (diff) | |
download | gcc-aed00696a01ac065e9ed327434ec29d1cf50179e.zip gcc-aed00696a01ac065e9ed327434ec29d1cf50179e.tar.gz gcc-aed00696a01ac065e9ed327434ec29d1cf50179e.tar.bz2 |
vect: allow using inbranch simdclones for masked loops
In a previous patch I did most of the work for this, but forgot to change the
check for number of arguments matching between call and simdclone. This check
should accept calls without a mask to be matched against simdclones with mask
arguments. I also added tests to verify this feature actually works.
gcc/ChangeLog:
* tree-vect-stmts.cc (vectorizable_simd_clone_call): Allow unmasked
calls to use masked simdclones.
gcc/testsuite/ChangeLog:
* gcc.dg/vect/vect-simd-clone-20.c: New file.
* gfortran.dg/simd-builtins-1.h: Adapt.
* gfortran.dg/simd-builtins-6.f90: Adapt.
Diffstat (limited to 'gcc/tree-vect-stmts.cc')
-rw-r--r-- | gcc/tree-vect-stmts.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc index d374907..f895aaf 100644 --- a/gcc/tree-vect-stmts.cc +++ b/gcc/tree-vect-stmts.cc @@ -4149,10 +4149,19 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info, { unsigned int this_badness = 0; unsigned int num_calls; + /* The number of arguments in the call and the number of parameters in + the simdclone should match. However, when the simdclone is + 'inbranch', it could have one more paramater than nargs when using + an inbranch simdclone to call a non-inbranch call, either in a + non-masked loop using a all true constant mask, or inside a masked + loop using it's mask. */ + size_t simd_nargs = n->simdclone->nargs; + if (!masked_call_offset && n->simdclone->inbranch) + simd_nargs--; if (!constant_multiple_p (vf * group_size, n->simdclone->simdlen, &num_calls) || (!n->simdclone->inbranch && (masked_call_offset > 0)) - || nargs != n->simdclone->nargs) + || (nargs != simd_nargs)) continue; if (num_calls != 1) this_badness += exact_log2 (num_calls) * 4096; |