From: Richard Biener Date: Tue, 20 Mar 2018 14:35:46 +0000 (+0000) Subject: re PR target/84986 (Performance regression: loop no longer vectorized (x86-64)) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b6c1e0329bb7c7b511d685ebb17ab4f2c515a75a;p=gcc.git re PR target/84986 (Performance regression: loop no longer vectorized (x86-64)) 2018-03-20 Richard Biener PR target/84986 * config/i386/i386.c (ix86_add_stmt_cost): Only cost sign-conversions as zero, fall back to standard scalar_stmt cost for the rest. * gcc.dg/vect/costmodel/x86_64/costmodel-pr84986.c: New testcase. From-SVN: r258684 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f47c1922f69..18d727e8ee3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2018-03-20 Richard Biener + + PR target/84986 + * config/i386/i386.c (ix86_add_stmt_cost): Only cost + sign-conversions as zero, fall back to standard scalar_stmt + cost for the rest. + 2018-03-20 Martin Liska PR ipa/84825 diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 5b1e962dedb..3b264318f50 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -50462,7 +50462,11 @@ ix86_add_stmt_cost (void *data, int count, enum vect_cost_for_stmt kind, } break; case NOP_EXPR: - stmt_cost = 0; + /* Only sign-conversions are free. */ + if (tree_nop_conversion_p + (TREE_TYPE (gimple_assign_lhs (stmt_info->stmt)), + TREE_TYPE (gimple_assign_rhs1 (stmt_info->stmt)))) + stmt_cost = 0; break; case BIT_IOR_EXPR: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6c918c0065b..f88a09842fa 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-03-20 Richard Biener + + PR target/84986 + * gcc.dg/vect/costmodel/x86_64/costmodel-pr84986.c: New testcase. + 2018-03-20 Martin Liska PR ipa/84825 diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/x86_64/costmodel-pr84986.c b/gcc/testsuite/gcc.dg/vect/costmodel/x86_64/costmodel-pr84986.c new file mode 100644 index 00000000000..b6dc385855e --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/costmodel/x86_64/costmodel-pr84986.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target vect_long } */ + +int N; +long fn1(void) { + short i; + long a; + i = a = 0; + while (i < N) + a -= i++; + return a; +} + +/* { dg-final { scan-tree-dump "vectorized 1 loops" "vect" } } */