From patchwork Tue Jun 21 12:07:20 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ira Rosen X-Patchwork-Id: 2120 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 94E4B23E02 for ; Tue, 21 Jun 2011 12:07:23 +0000 (UTC) Received: from mail-vx0-f180.google.com (mail-vx0-f180.google.com [209.85.220.180]) by fiordland.canonical.com (Postfix) with ESMTP id 51738A187E5 for ; Tue, 21 Jun 2011 12:07:23 +0000 (UTC) Received: by vxd7 with SMTP id 7so3444989vxd.11 for ; Tue, 21 Jun 2011 05:07:22 -0700 (PDT) Received: by 10.52.98.97 with SMTP id eh1mr9072435vdb.7.1308658042739; Tue, 21 Jun 2011 05:07:22 -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.52.183.130 with SMTP id em2cs61796vdc; Tue, 21 Jun 2011 05:07:22 -0700 (PDT) Received: by 10.220.65.97 with SMTP id h33mr1757084vci.52.1308658042251; Tue, 21 Jun 2011 05:07:22 -0700 (PDT) Received: from mail-pv0-f178.google.com (mail-pv0-f178.google.com [74.125.83.178]) by mx.google.com with ESMTPS id 14si4026094vcy.150.2011.06.21.05.07.20 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 21 Jun 2011 05:07:21 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.83.178 is neither permitted nor denied by best guess record for domain of ira.rosen@linaro.org) client-ip=74.125.83.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.83.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 pvg7 with SMTP id 7so2882766pvg.37 for ; Tue, 21 Jun 2011 05:07:20 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.188.14 with SMTP id l14mr981690wff.398.1308658040159; Tue, 21 Jun 2011 05:07:20 -0700 (PDT) Received: by 10.143.79.13 with HTTP; Tue, 21 Jun 2011 05:07:20 -0700 (PDT) Date: Tue, 21 Jun 2011 15:07:20 +0300 Message-ID: Subject: [patch] Fix PR tree-optimization/49478 From: Ira Rosen To: gcc-patches@gcc.gnu.org Cc: Patch Tracking Hi, This patch adds a missing support of widening multiplication by a constant in case of DOT_PROD_EXPR: the type of the constant operand should be set according to the other operand. Bootstrapped and tested on powerpc64-suse-linux. Committed. Ira ChangeLog: PR tree-optimization/49478 * tree-vect-loop.c (vectorizable_reduction): Handle DOT_PROD_EXPR with constant operand. testsuite/ChangeLog: PR tree-optimization/49478 * gcc.dg/vect/pr49478.c Index: testsuite/gcc.dg/vect/pr49478.c =================================================================== --- testsuite/gcc.dg/vect/pr49478.c (revision 0) +++ testsuite/gcc.dg/vect/pr49478.c (revision 0) @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target vect_int } */ + +#include + +#define N 64 + +unsigned char X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63}; + +unsigned int +foo (int len) { + int i; + unsigned int result = 0; + unsigned short prod; + + for (i=0; i