From patchwork Fri Oct 19 12:34:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 986748 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-487884-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="l81mPLyW"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42c53J11blz9sD9 for ; Fri, 19 Oct 2018 23:35:06 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=CowhMc2O9qdIv8QXngdOnEFCbiIZQLshLMEzpNjtxHUmzk5b2wMNT P69Guu+enLP/rZUop0bLQyTCtiUFJ7odxScjnTAk0EQCzOuv4pAF1elg29GywYeu jX29qoUADaTZFxScM5qx7P3hPmhM2Ir8TuB3nwcBeVgcyDfhTlfZps= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=08g0mSK2Z9wNQ1tT3weDT5FbBvA=; b=l81mPLyW0c+C2FL4lVd7 QU3fij2a5/fTho3gM+lzNq0bDbi28PB4EG11nQzKM0nZeXYdOK2oUw9jLVKBftyP YIuKk4sZpJq4hNj+6SNNEKP6/Z/ykysXHgut4oC1fG18CoPz7Haucp7PrvHBInMb PCORSDbdDg2cZDsEjiYzoO4= Received: (qmail 18107 invoked by alias); 19 Oct 2018 12:34:59 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 18091 invoked by uid 89); 19 Oct 2018 12:34:58 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.6 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_NUMSUBJECT, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 19 Oct 2018 12:34:57 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 7D71CAD56 for ; Fri, 19 Oct 2018 12:34:54 +0000 (UTC) Date: Fri, 19 Oct 2018 14:34:54 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR87657 Message-ID: User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 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 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