Hi all,
This patch addresses PR97929 by adding a missing case for WIDEN_PLUS/MINUS in
vect_get_smallest_scalar_type. It also introduces a test to check for
regression.
One thing to note is that I saw a failure on c-c++-common/builtins.c which
disappeared when I ran the test again. I assume this is due to the test being
unreliable.
Bootstrapped and regression tested all together.
Ok for trunk?
[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.
From 1d7855aab9ea099f244e50baede24c50897f6eb5 Mon Sep 17 00:00:00 2001
From: Joel Hutton <joel.hut...@arm.com>
Date: Wed, 9 Dec 2020 16:51:17 +0000
Subject: [PATCH 2/2] [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.
---
gcc/testsuite/gcc.dg/vect/pr97929.c | 10 ++++++++++
gcc/tree-vect-data-refs.c | 2 ++
2 files changed, 12 insertions(+)
create mode 100644 gcc/testsuite/gcc.dg/vect/pr97929.c
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 <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;
+ }
+}
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));
--
2.17.1