The following fixes an ICE I introduced in the x86 backend by not considering word_mode vectorization.
Bootstrap & regtest running on x86_64-unknown-linux-gnu, will apply after that succeeded. Richard. 2018-10-19 Richard Biener <rguent...@suse.de> 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. Index: gcc/config/i386/i386.c =================================================================== --- gcc/config/i386/i386.c (revision 265312) +++ gcc/config/i386/i386.c (working copy) @@ -45173,9 +45173,8 @@ ix86_builtin_vectorization_cost (enum ve 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); Index: gcc/testsuite/gcc.target/i386/pr87657.c =================================================================== --- gcc/testsuite/gcc.target/i386/pr87657.c (nonexistent) +++ gcc/testsuite/gcc.target/i386/pr87657.c (working copy) @@ -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