From patchwork Sun Oct 9 15:09:42 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ira Rosen X-Patchwork-Id: 4576 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 3E36F23EFA for ; Sun, 9 Oct 2011 15:09:46 +0000 (UTC) Received: from mail-bw0-f52.google.com (mail-bw0-f52.google.com [209.85.214.52]) by fiordland.canonical.com (Postfix) with ESMTP id 0D8E3A190FC for ; Sun, 9 Oct 2011 15:09:46 +0000 (UTC) Received: by bke5 with SMTP id 5so9325333bke.11 for ; Sun, 09 Oct 2011 08:09:45 -0700 (PDT) Received: by 10.223.61.146 with SMTP id t18mr25681986fah.34.1318172985564; Sun, 09 Oct 2011 08:09:45 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.23.170 with SMTP id n10cs64670laf; Sun, 9 Oct 2011 08:09:45 -0700 (PDT) Received: by 10.236.79.170 with SMTP id i30mr19228571yhe.94.1318172983552; Sun, 09 Oct 2011 08:09:43 -0700 (PDT) Received: from mail-gy0-f178.google.com (mail-gy0-f178.google.com [209.85.160.178]) by mx.google.com with ESMTPS id o17si6133988ann.95.2011.10.09.08.09.42 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 09 Oct 2011 08:09:43 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.178 is neither permitted nor denied by best guess record for domain of ira.rosen@linaro.org) client-ip=209.85.160.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.178 is neither permitted nor denied by best guess record for domain of ira.rosen@linaro.org) smtp.mail=ira.rosen@linaro.org Received: by gyf1 with SMTP id 1so5621837gyf.37 for ; Sun, 09 Oct 2011 08:09:42 -0700 (PDT) MIME-Version: 1.0 Received: by 10.146.2.5 with SMTP id 5mr2912829yab.27.1318172982474; Sun, 09 Oct 2011 08:09:42 -0700 (PDT) Received: by 10.147.99.14 with HTTP; Sun, 9 Oct 2011 08:09:42 -0700 (PDT) Date: Sun, 9 Oct 2011 17:09:42 +0200 Message-ID: Subject: [patch] Fix PR tree-optimization/50635 From: Ira Rosen To: gcc-patches@gcc.gnu.org Cc: Patch Tracking Hi, In vectorizer pattern recognition when a pattern def_stmt already exists, we need to mark it properly for the current pattern. Another problem is that we don't really have to check that TYPE_OUT is a vector type. It is set by the pattern detection procedures, and if the type is invalid we fail later in the operation analysis anyway. Bootstrapped and tested on powerpc64-suse-linux. Committed. Ira ChangeLog: PR tree-optimization/50635 * tree-vect-patterns.c (vect_handle_widen_mult_by_const): Add DEF_STMT to the list of statements to be replaced by the pattern statements. (vect_handle_widen_mult_by_const): Don't check TYPE_OUT. testsuite/ChangeLog: PR tree-optimization/50635 * gcc.dg/vect/pr50635.c: New test. Index: testsuite/gcc.dg/vect/pr50635.c =================================================================== --- testsuite/gcc.dg/vect/pr50635.c (revision 0) +++ testsuite/gcc.dg/vect/pr50635.c (revision 0) @@ -0,0 +1,21 @@ +/* { dg-do compile } */ + +typedef signed long int32_t; +typedef char int8_t; + +void f0a(int32_t * result, int32_t * arg1, int8_t * arg2, int32_t temp_3) +{ + int idx; + for (idx=0;idx<10;idx += 1) + { + int32_t temp_4; + int32_t temp_12; + + temp_4 = (-2 & arg2[idx]) + temp_3; + temp_12 = -2 * arg2[idx] + temp_4; + result[idx] = temp_12; + } +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ + Index: tree-vect-patterns.c =================================================================== --- tree-vect-patterns.c (revision 179718) +++ tree-vect-patterns.c (working copy) @@ -388,6 +388,7 @@ vect_handle_widen_mult_by_const (gimple stmt, tree || TREE_TYPE (gimple_assign_lhs (new_stmt)) != new_type) return false; + VEC_safe_push (gimple, heap, *stmts, def_stmt); *oprnd = gimple_assign_lhs (new_stmt); } else @@ -1424,8 +1425,6 @@ vect_pattern_recog_1 (vect_recog_func_ptr vect_rec { /* No need to check target support (already checked by the pattern recognition function). */ - if (type_out) - gcc_assert (VECTOR_MODE_P (TYPE_MODE (type_out))); pattern_vectype = type_out ? type_out : type_in; } else