[Vect] Fix mask check on Scatter loads/stores
Previously, IFN_MASK_SCATTER_STORE was used if 'loop_masks' was non-null, but the mask used is 'final_mask'. This caused a bug where a 'MASK_STORE' was vectorized into a 'SCATTER_STORE' instead of a 'MASK_SCATTER_STORE'. This fixes PR target/99102. gcc/ChangeLog: PR target/99102 * tree-vect-stmts.c (vectorizable_store): Fix scatter store mask check condition. (vectorizable_load): Fix gather load mask check condition. gcc/testsuite/ChangeLog: PR target/99102 * gcc.dg/vect/pr99102.c: New test.
This commit is contained in:
parent
6ceb712e26
commit
99d5299376
20
gcc/testsuite/gcc.dg/vect/pr99102.c
Normal file
20
gcc/testsuite/gcc.dg/vect/pr99102.c
Normal file
@ -0,0 +1,20 @@
|
||||
/* { dg-options "-O2 -ftree-vectorize" } */
|
||||
/* { dg-additional-options "-msve-vector-bits=256" { target aarch64_sve } } */
|
||||
long a[44];
|
||||
short d, e = -7;
|
||||
__attribute__((noipa)) void b(char f, short j, short k, unsigned l) {
|
||||
for (int g = 0; g < 9; g += f)
|
||||
for (int b = 0; b < 90; b -= k)
|
||||
for (int h = 0; h < f; h++)
|
||||
for (short i = 0; i < 15; i += 4)
|
||||
if (!l)
|
||||
a[i] = j;
|
||||
}
|
||||
int main() {
|
||||
for (long c = 0; c < 2; ++c)
|
||||
a[c] = 7;
|
||||
b(9, d, e, 5);
|
||||
if (!a[0])
|
||||
__builtin_abort();
|
||||
}
|
||||
/* { dg-final { scan-tree-dump "MASK_SCATTER_STORE" "vect" { target aarch64_sve } } } */
|
@ -8126,7 +8126,7 @@ vectorizable_store (vec_info *vinfo,
|
||||
{
|
||||
tree scale = size_int (gs_info.scale);
|
||||
gcall *call;
|
||||
if (loop_masks)
|
||||
if (final_mask)
|
||||
call = gimple_build_call_internal
|
||||
(IFN_MASK_SCATTER_STORE, 5, dataref_ptr, vec_offset,
|
||||
scale, vec_oprnd, final_mask);
|
||||
@ -9419,7 +9419,7 @@ vectorizable_load (vec_info *vinfo,
|
||||
tree zero = build_zero_cst (vectype);
|
||||
tree scale = size_int (gs_info.scale);
|
||||
gcall *call;
|
||||
if (loop_masks)
|
||||
if (final_mask)
|
||||
call = gimple_build_call_internal
|
||||
(IFN_MASK_GATHER_LOAD, 5, dataref_ptr,
|
||||
vec_offset, scale, zero, final_mask);
|
||||
|
Loading…
Reference in New Issue
Block a user