aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/g++.target/aarch64/sve/pr98177-1.C10
-rw-r--r--gcc/testsuite/g++.target/aarch64/sve/pr98177-2.C10
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/pr98177-1.c10
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/pr98177-2.c10
-rw-r--r--gcc/tree-vect-loop.c8
5 files changed, 44 insertions, 4 deletions
diff --git a/gcc/testsuite/g++.target/aarch64/sve/pr98177-1.C b/gcc/testsuite/g++.target/aarch64/sve/pr98177-1.C
new file mode 100644
index 0000000..9789193
--- /dev/null
+++ b/gcc/testsuite/g++.target/aarch64/sve/pr98177-1.C
@@ -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;
+}
diff --git a/gcc/testsuite/g++.target/aarch64/sve/pr98177-2.C b/gcc/testsuite/g++.target/aarch64/sve/pr98177-2.C
new file mode 100644
index 0000000..c7244ef
--- /dev/null
+++ b/gcc/testsuite/g++.target/aarch64/sve/pr98177-2.C
@@ -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;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr98177-1.c b/gcc/testsuite/gcc.target/aarch64/sve/pr98177-1.c
new file mode 100644
index 0000000..9789193
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/pr98177-1.c
@@ -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;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr98177-2.c b/gcc/testsuite/gcc.target/aarch64/sve/pr98177-2.c
new file mode 100644
index 0000000..c7244ef
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/pr98177-2.c
@@ -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;
+}
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 688538a..d6f1ffc 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -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))