aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2025-08-05 14:55:18 +0200
committerRichard Biener <rguenth@gcc.gnu.org>2025-08-06 15:17:04 +0200
commit50b1959cab19bdaf4f457f30e70a950ad9d35c6d (patch)
treebae2cbc07fa2024adf05058ffd811435ba08addd /gcc
parent685527a408ea025591c7f887566d7049ddd72c02 (diff)
downloadgcc-50b1959cab19bdaf4f457f30e70a950ad9d35c6d.zip
gcc-50b1959cab19bdaf4f457f30e70a950ad9d35c6d.tar.gz
gcc-50b1959cab19bdaf4f457f30e70a950ad9d35c6d.tar.bz2
Allow fully masked loops with legacy gather/scatter
The following removes the redundant check on supported gather/scatter IFN in check_load_store_for_partial_vectors which is already done and adjusts those to check the recorded ifn, also allowing legacy gather/scatter which all handle masking. * tree-vect-stmts.cc (check_load_store_for_partial_vectors): Remove redundant gather/scatter target support check, instead check the recorded ifns. Also allow legacy gather/scatter with loop masking. * gcc.dg/vect/vect-gather-1.c: Adjust to hide N.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-gather-1.c6
-rw-r--r--gcc/tree-vect-stmts.cc3
2 files changed, 5 insertions, 4 deletions
diff --git a/gcc/testsuite/gcc.dg/vect/vect-gather-1.c b/gcc/testsuite/gcc.dg/vect/vect-gather-1.c
index 5f6640d..6497ab4 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-gather-1.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-gather-1.c
@@ -3,9 +3,9 @@
#define N 16
void __attribute__((noipa))
-f (int *restrict y, int *restrict x, int *restrict indices)
+f (int *restrict y, int *restrict x, int *restrict indices, int n)
{
- for (int i = 0; i < N; ++i)
+ for (int i = 0; i < n; ++i)
{
y[i * 2] = x[indices[i * 2]] + 1;
y[i * 2 + 1] = x[indices[i * 2 + 1]] + 2;
@@ -49,7 +49,7 @@ main (void)
{
check_vect ();
- f (y, x, indices);
+ f (y, x, indices, N);
#pragma GCC novector
for (int i = 0; i < 32; ++i)
if (y[i] != expected[i])
diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index f7a052b..f3af310 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -1497,7 +1497,8 @@ check_load_store_for_partial_vectors (loop_vec_info loop_vinfo, tree vectype,
gs_info->memory_type,
gs_info->offset_vectype,
gs_info->scale,
- elsvals))
+ elsvals)
+ || gs_info->decl != NULL_TREE)
vect_record_loop_mask (loop_vinfo, masks, nvectors, vectype,
scalar_mask);
else