From patchwork Fri Oct 12 21:19:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Glisse X-Patchwork-Id: 191220 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id BE5542C0094 for ; Sat, 13 Oct 2012 08:20:01 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1350681602; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Date:From:To:Subject:Message-ID:User-Agent:MIME-Version: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=uDqZLie uyZnd3t2axOlWn/V7I9M=; b=gbfEpnllvlP5R2bdNzaTrE4ahizxpGExXszpBgq lJbBgKwD8/46+SAP0uZMu80BLQ8ePCswZH5sY9zTal/4wxbUGtbR4HLtC5lIrNGf 0VElpktHvmbfTfzsXSgVuejcU1zvso8JWXKotsCu+aPVuGTc/O0gU5sBzBVD4IJd /yAo= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Date:From:To:Subject:Message-ID:User-Agent:MIME-Version:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=U137Givr7Pa3lH/GA91O/vuC/5jZWacXh/Oq8t059H6NTnjlvOvOAk0a7NGzuA RK0NThVqOkeSLbdkqywn02R8ljCDmgSl03kXdzYfyfTNxaf1Uz6tB6XFUoyvB4uE t5+2cwIzL13c8uAGBmTc0Ar53Q8NaSF086g965SiopN7Q=; Received: (qmail 18633 invoked by alias); 12 Oct 2012 21:19:57 -0000 Received: (qmail 18625 invoked by uid 22791); 12 Oct 2012 21:19:56 -0000 X-SWARE-Spam-Status: No, hits=-8.2 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail1-relais-roc.national.inria.fr (HELO mail1-relais-roc.national.inria.fr) (192.134.164.82) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 12 Oct 2012 21:19:52 +0000 Received: from stedding.saclay.inria.fr ([193.55.250.194]) by mail1-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES128-SHA; 12 Oct 2012 23:19:51 +0200 Received: from glisse (helo=localhost) by stedding.saclay.inria.fr with local-esmtp (Exim 4.80) (envelope-from ) id 1TMme7-00051J-2y for gcc-patches@gcc.gnu.org; Fri, 12 Oct 2012 23:19:51 +0200 Date: Fri, 12 Oct 2012 23:19:51 +0200 (CEST) From: Marc Glisse To: gcc-patches@gcc.gnu.org Subject: PR54915 (ssa-forwprop, vec_perm_expr) Message-ID: User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 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 Hello, apparently, in the optimization that recognizes that {v[1],v[0]} is a VEC_PERM_EXPR, I forgot to check that v is a 2-element vector... (not that there aren't things that could be done if v has a different size, just not directly a VEC_PERM_EXPR, and not right now, priority is to fix the bug) Checking that v has the same type as the result seemed like the easiest way, but there are many variations that could be slightly better or worse. bootstrap+testsuite ok. 2012-10-02 Marc Glisse PR tree-optimization/54915 gcc/ * tree-ssa-forwprop.c (simplify_vector_constructor): Check argument's type. gcc/testsuite/ * gcc.dg/tree-ssa/pr54915.c: New testcase. Index: tree-ssa-forwprop.c =================================================================== --- tree-ssa-forwprop.c (revision 192408) +++ tree-ssa-forwprop.c (working copy) @@ -2833,20 +2833,22 @@ simplify_vector_constructor (gimple_stmt ref = TREE_OPERAND (op1, 0); if (orig) { if (ref != orig) return false; } else { if (TREE_CODE (ref) != SSA_NAME) return false; + if (TREE_TYPE (ref) != type) + return false; orig = ref; } if (TREE_INT_CST_LOW (TREE_OPERAND (op1, 1)) != elem_size) return false; sel[i] = TREE_INT_CST_LOW (TREE_OPERAND (op1, 2)) / elem_size; if (sel[i] != i) maybe_ident = false; } if (i < nelts) return false; Index: testsuite/gcc.dg/tree-ssa/pr54915.c =================================================================== --- testsuite/gcc.dg/tree-ssa/pr54915.c (revision 0) +++ testsuite/gcc.dg/tree-ssa/pr54915.c (revision 0) @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +typedef double v2df __attribute__ ((__vector_size__ (16))); +typedef double v4df __attribute__ ((__vector_size__ (32))); + +void f (v2df *ret, v4df* xp) +{ + v4df x = *xp; + v2df xx = { x[2], x[3] }; + *ret = xx; +}