From 6d2648763a1b8a74a85d04139c5d1391056810fa Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 19 Oct 2018 14:27:57 +0000 Subject: [PATCH] re PR tree-optimization/87657 (SLP ICE in libgfortran matmul_i2_vanilla) 2018-10-19 Richard Biener PR target/87657 * config/i386/i386.c (ix86_builtin_vectorization_cost): Use TYPE_VECTOR_SUBPARTS and avoid relying on vector mode. * gcc.target/i386/pr87657.c: New testcase. From-SVN: r265316 --- gcc/ChangeLog | 6 ++++++ gcc/config/i386/i386.c | 3 +-- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/pr87657.c | 22 ++++++++++++++++++++++ 4 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr87657.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 50f8d785911..082ef49dcb0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-10-19 Richard Biener + + PR target/87657 + * config/i386/i386.c (ix86_builtin_vectorization_cost): Use + TYPE_VECTOR_SUBPARTS and avoid relying on vector mode. + 2018-10-19 H.J. Lu PR target/72782 diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index e47603eb5ff..963c7fcbb34 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -45173,9 +45173,8 @@ ix86_builtin_vectorization_cost (enum vect_cost_for_stmt type_of_cost, case vec_construct: { - gcc_assert (VECTOR_MODE_P (mode)); /* N element inserts into SSE vectors. */ - int cost = GET_MODE_NUNITS (mode) * ix86_cost->sse_op; + int cost = TYPE_VECTOR_SUBPARTS (vectype) * ix86_cost->sse_op; /* One vinserti128 for combining two SSE vectors for AVX256. */ if (GET_MODE_BITSIZE (mode) == 256) cost += ix86_vec_cost (mode, ix86_cost->addss); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5f216f05425..4fd3f91c860 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-10-19 Richard Biener + + PR target/87657 + * gcc.target/i386/pr87657.c: New testcase. + 2018-10-19 H.J. Lu PR target/72782 diff --git a/gcc/testsuite/gcc.target/i386/pr87657.c b/gcc/testsuite/gcc.target/i386/pr87657.c new file mode 100644 index 00000000000..14ba6b4757d --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr87657.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-slp-vectorize -fno-vect-cost-model -mno-sse" } */ + +int x; + +void foo (short a, short b) +{ + ((short *)&x)[0] = a; + ((short *)&x)[1] = b; +} + +#if __SIZEOF_LONG__ == 8 +long y; + +void bar (short a, short b) +{ + ((short *)&y)[0] = a; + ((short *)&y)[1] = b; + ((short *)&y)[2] = a; + ((short *)&y)[3] = b; +} +#endif -- 2.30.2