diff options
author | Richard Biener <rguenther@suse.de> | 2019-04-08 13:54:02 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2019-04-08 13:54:02 +0000 |
commit | a265c9a929b4ca727e9b0c93eb98e15244f2735c (patch) | |
tree | b058f1cb2343f3c7617a416d726b7a0c79311399 /gcc | |
parent | b8e214c6b32789f96256bf1a89490dbc550a9dc8 (diff) | |
download | gcc-a265c9a929b4ca727e9b0c93eb98e15244f2735c.zip gcc-a265c9a929b4ca727e9b0c93eb98e15244f2735c.tar.gz gcc-a265c9a929b4ca727e9b0c93eb98e15244f2735c.tar.bz2 |
re PR tree-optimization/90006 (gcc loops indefinitely around vect_get_constant_vectors on -O2 -ftree-slp-vectorize -fno-math-errno)
2019-04-08 Richard Biener <rguenther@suse.de>
PR tree-optimization/90006
* tree-vect-data-refs.c (vect_get_smallest_scalar_type): Handle
calls like lrint.
* gcc.dg/vect/bb-slp-pr90006.c: New testcase.
From-SVN: r270210
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/bb-slp-pr90006.c | 31 | ||||
-rw-r--r-- | gcc/tree-vect-data-refs.c | 9 |
4 files changed, 51 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 51fc0bf..845f21e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-04-08 Richard Biener <rguenther@suse.de> + + PR tree-optimization/90006 + * tree-vect-data-refs.c (vect_get_smallest_scalar_type): Handle + calls like lrint. + 2019-04-08 Andrea Corallo <andrea.corallo@arm.com> PR target/83033 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9b7b08d..038a431 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-04-08 Richard Biener <rguenther@suse.de> + + PR tree-optimization/90006 + * gcc.dg/vect/bb-slp-pr90006.c: New testcase. + 2019-04-08 Jakub Jelinek <jakub@redhat.com> PR rtl-optimization/89865 diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr90006.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr90006.c new file mode 100644 index 0000000..104d3fb --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr90006.c @@ -0,0 +1,31 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-fno-math-errno" } */ +/* { dg-additional-options "-march=x86-64" { target x86_64-*-* i?86-*-* } } */ + +long int lrint(double x); + +int a, b; +union c { + int d; +}; + +int e() +{ + int f, g, h; + long i, j, k; + double l, m = b = lrint(0.3127); + a = b >> 16 >> 8 & 255; + ((union c *)e)->d = a; + k = m; + h = k >> 16 >> 8 & 255; + ((union c *)(e + 4))->d = h; + j = lrint(l); + g = j >> 16 >> 8 & 255; + ((union c *)(e + 8))->d = g; + i = lrint(0.292); + f = i >> 16 >> 8 & 255; + ((union c *)(e + 12))->d = f; + return 0; +} + +/* { dg-final { scan-tree-dump "basic block vectorized" "slp2" { target { { x86_64-*-* i?86-*-* } && ilp32 } } } } */ diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index 1380088..8f185c9 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -145,6 +145,15 @@ vect_get_smallest_scalar_type (stmt_vec_info stmt_info, if (rhs < lhs) scalar_type = rhs_type; } + else if (is_gimple_call (stmt_info->stmt) + && gimple_call_num_args (stmt_info->stmt) > 0) + { + tree rhs_type = TREE_TYPE (gimple_call_arg (stmt_info->stmt, 0)); + + rhs = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (rhs_type)); + if (rhs < lhs) + scalar_type = rhs_type; + } *lhs_size_unit = lhs; *rhs_size_unit = rhs; |