[VECT] pr97929 fix
authorJoel Hutton <joel.hutton@arm.com>
Thu, 10 Dec 2020 11:55:18 +0000 (11:55 +0000)
committerJoel Hutton <joel.hutton@arm.com>
Thu, 10 Dec 2020 11:58:23 +0000 (11:58 +0000)
This addresses pr97929. The case for WIDEN_PLUS and WIDEN_MINUS were
missing in vect_get_smallest_scalar_type.

gcc/ChangeLog:

PR tree-optimization/97929
* tree-vect-data-refs.c (vect_get_smallest_scalar_type): Add
WIDEN_PLUS/WIDEN_MINUS case.

gcc/testsuite/ChangeLog:

* gcc.dg/vect/pr97929.c: New test.

gcc/testsuite/gcc.dg/vect/pr97929.c [new file with mode: 0644]
gcc/tree-vect-data-refs.c

diff --git a/gcc/testsuite/gcc.dg/vect/pr97929.c b/gcc/testsuite/gcc.dg/vect/pr97929.c
new file mode 100644 (file)
index 0000000..a027b31
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+#include <stdint.h>
+#define ARR_SIZE 1024
+extern void foo (int32_t *bar, int16_t a)
+{
+    for( int i = 0; i < ARR_SIZE;i++)
+    {
+        bar[i]  = a + 1;
+    }
+}
index 18e36c89d1475dbe1fe92ff757f21839e5db9d59..137017091e88ddd749e9373870236804f9d05fa1 100644 (file)
@@ -136,6 +136,8 @@ vect_get_smallest_scalar_type (stmt_vec_info stmt_info,
          || gimple_assign_rhs_code (assign) == WIDEN_SUM_EXPR
          || gimple_assign_rhs_code (assign) == WIDEN_MULT_EXPR
          || gimple_assign_rhs_code (assign) == WIDEN_LSHIFT_EXPR
+         || gimple_assign_rhs_code (assign) == WIDEN_PLUS_EXPR
+         || gimple_assign_rhs_code (assign) == WIDEN_MINUS_EXPR
          || gimple_assign_rhs_code (assign) == FLOAT_EXPR))
     {
       tree rhs_type = TREE_TYPE (gimple_assign_rhs1 (assign));