aarch64: SVE: ICE in expand_direct_optab_fn [PR98177]
Problem comes from using the wrong interface to get the index type for a COND_REDUCTION. For fixed-length SVE we get a V2SI (a 64-bit Advanced SIMD vector) instead of a VNx2SI (an SVE vector that stores SI elements in DI containers). Credits to Richard Sandiford for pointing out the issue's root cause. Original PR snippet proposed to reproduce issue was only causing ICE for C++ compiler (see pr98177-1 test cases). I've slightly modified original snippet in order to reproduce issue on both C and C++ compilers. These are pr98177-2 test cases. gcc/ChangeLog: PR target/98177 * tree-vect-loop.c (vect_create_epilog_for_reduction): Use get_same_sized_vectype to obtain index type. (vectorizable_reduction): Likewise. gcc/testsuite/ChangeLog: PR target/98177 * g++.target/aarch64/sve/pr98177-1.C: New test. * g++.target/aarch64/sve/pr98177-2.C: New test. * gcc.target/aarch64/sve/pr98177-1.c: New test. * gcc.target/aarch64/sve/pr98177-2.c: New test.
This commit is contained in:
parent
60cecb2b83
commit
d44d47b492
5 changed files with 44 additions and 4 deletions
10
gcc/testsuite/g++.target/aarch64/sve/pr98177-1.C
Normal file
10
gcc/testsuite/g++.target/aarch64/sve/pr98177-1.C
Normal file
|
@ -0,0 +1,10 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "-Ofast -msve-vector-bits=128" } */
|
||||
|
||||
int a, b;
|
||||
short c;
|
||||
void d(long e) {
|
||||
for (int f = 0; f < b; f += 1)
|
||||
for (short g = 0; g < c; g += 5)
|
||||
a = (short)e;
|
||||
}
|
10
gcc/testsuite/g++.target/aarch64/sve/pr98177-2.C
Normal file
10
gcc/testsuite/g++.target/aarch64/sve/pr98177-2.C
Normal file
|
@ -0,0 +1,10 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "-Ofast -msve-vector-bits=128" } */
|
||||
|
||||
int a, b, c;
|
||||
|
||||
void foo(long e) {
|
||||
for (int f = 0; f < b; f ++)
|
||||
for (int g = 0; g < c; g ++)
|
||||
a = (short)e;
|
||||
}
|
10
gcc/testsuite/gcc.target/aarch64/sve/pr98177-1.c
Normal file
10
gcc/testsuite/gcc.target/aarch64/sve/pr98177-1.c
Normal file
|
@ -0,0 +1,10 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "-Ofast -msve-vector-bits=128" } */
|
||||
|
||||
int a, b;
|
||||
short c;
|
||||
void d(long e) {
|
||||
for (int f = 0; f < b; f += 1)
|
||||
for (short g = 0; g < c; g += 5)
|
||||
a = (short)e;
|
||||
}
|
10
gcc/testsuite/gcc.target/aarch64/sve/pr98177-2.c
Normal file
10
gcc/testsuite/gcc.target/aarch64/sve/pr98177-2.c
Normal file
|
@ -0,0 +1,10 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "-Ofast -msve-vector-bits=128" } */
|
||||
|
||||
int a, b, c;
|
||||
|
||||
void foo(long e) {
|
||||
for (int f = 0; f < b; f ++)
|
||||
for (int g = 0; g < c; g ++)
|
||||
a = (short)e;
|
||||
}
|
|
@ -5278,8 +5278,8 @@ vect_create_epilog_for_reduction (loop_vec_info loop_vinfo,
|
|||
int scalar_precision
|
||||
= GET_MODE_PRECISION (SCALAR_TYPE_MODE (scalar_type));
|
||||
tree scalar_type_unsigned = make_unsigned_type (scalar_precision);
|
||||
tree vectype_unsigned = build_vector_type
|
||||
(scalar_type_unsigned, TYPE_VECTOR_SUBPARTS (vectype));
|
||||
tree vectype_unsigned = get_same_sized_vectype (scalar_type_unsigned,
|
||||
vectype);
|
||||
|
||||
/* First we need to create a vector (ZERO_VEC) of zeros and another
|
||||
vector (MAX_INDEX_VEC) filled with the last matching index, which we
|
||||
|
@ -6942,8 +6942,8 @@ vectorizable_reduction (loop_vec_info loop_vinfo,
|
|||
int scalar_precision
|
||||
= GET_MODE_PRECISION (SCALAR_TYPE_MODE (scalar_type));
|
||||
cr_index_scalar_type = make_unsigned_type (scalar_precision);
|
||||
cr_index_vector_type = build_vector_type (cr_index_scalar_type,
|
||||
nunits_out);
|
||||
cr_index_vector_type = get_same_sized_vectype (cr_index_scalar_type,
|
||||
vectype_out);
|
||||
|
||||
if (direct_internal_fn_supported_p (IFN_REDUC_MAX, cr_index_vector_type,
|
||||
OPTIMIZE_FOR_SPEED))
|
||||
|
|
Loading…
Add table
Reference in a new issue