From: Joel Hutton Date: Thu, 10 Dec 2020 11:55:18 +0000 (+0000) Subject: [VECT] pr97929 fix X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f5b902a9af9d1cce6c540c7f71e02e22e45c23ef;p=gcc.git [VECT] pr97929 fix 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. --- diff --git a/gcc/testsuite/gcc.dg/vect/pr97929.c b/gcc/testsuite/gcc.dg/vect/pr97929.c new file mode 100644 index 00000000000..a027b317151 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr97929.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +#include +#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; + } +} diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index 18e36c89d14..137017091e8 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -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));