From patchwork Thu Jun 14 11:26:46 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramana Radhakrishnan X-Patchwork-Id: 9279 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 0AD9923E4F for ; Thu, 14 Jun 2012 11:26:50 +0000 (UTC) Received: from mail-ob0-f180.google.com (mail-ob0-f180.google.com [209.85.214.180]) by fiordland.canonical.com (Postfix) with ESMTP id BA40DA180B9 for ; Thu, 14 Jun 2012 11:26:49 +0000 (UTC) Received: by obbun3 with SMTP id un3so2566824obb.11 for ; Thu, 14 Jun 2012 04:26:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf :mime-version:date:message-id:subject:from:to:cc:content-type :x-gm-message-state; bh=QxVpdgmV8ePgt0WycZE/kkyVZnq5HVjfw3KiZZTfi/0=; b=YHa3cyKhgXTJDywpuBxDUZx7afAqDvkS5ON7NcIYHkMAjlFh2C3hE7yAL1Pe1QNEFx 098OsS51Eohndbzf1GNEjL0e1ag6qnEOoocaFqF4doxMOdXIIjDSWzfJy64U18oRR02x D5z4LKo8zLTbsFXhRykQZSEC6U5UwhzkFMaeq/Z2ml0W9VaBunn0WucPgAj6Cp7QrXdH kR7VBjHcCpDmlGJysVo2/Fh7cieQxd4KmYavjqQbU58oOaTHtJAYsKZRO/GSTUbIc9Dn PkicDyG8BxU5Osmkc2SEWmTlVaFEQVc/6JsM6+P79IfrLaKpLs2SdG6NxOfyf3bMq3Hr RUMw== Received: by 10.50.207.3 with SMTP id ls3mr17137895igc.0.1339673209013; Thu, 14 Jun 2012 04:26:49 -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.231.24.148 with SMTP id v20csp79116ibb; Thu, 14 Jun 2012 04:26:48 -0700 (PDT) Received: by 10.52.65.145 with SMTP id x17mr673093vds.117.1339673207825; Thu, 14 Jun 2012 04:26:47 -0700 (PDT) Received: from mail-vb0-f50.google.com (mail-vb0-f50.google.com [209.85.212.50]) by mx.google.com with ESMTPS id g11si1230407vcq.200.2012.06.14.04.26.46 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 14 Jun 2012 04:26:47 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.50 is neither permitted nor denied by best guess record for domain of ramana.radhakrishnan@linaro.org) client-ip=209.85.212.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.50 is neither permitted nor denied by best guess record for domain of ramana.radhakrishnan@linaro.org) smtp.mail=ramana.radhakrishnan@linaro.org Received: by vbal1 with SMTP id l1so1340017vba.37 for ; Thu, 14 Jun 2012 04:26:46 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.240.7 with SMTP id ky7mr806556vcb.46.1339673206801; Thu, 14 Jun 2012 04:26:46 -0700 (PDT) Received: by 10.52.93.100 with HTTP; Thu, 14 Jun 2012 04:26:46 -0700 (PDT) Date: Thu, 14 Jun 2012 12:26:46 +0100 Message-ID: Subject: [Patch] Propagate vector constants into VEC_PERM_EXPR while lowering. From: Ramana Radhakrishnan To: gcc-patches Cc: Patch Tracking X-Gm-Message-State: ALoCoQmxuvdaB62YXQzQFKE5nxEe2/Efrw7X+ORrYLnB5fyn3yJdtoNRa2sdhjHA6ebUeuybUoEv Hi, This patch allows propagation of vector constants into VEC_PERM_EXPRs in lower_vec_perm, motivation explained in http://gcc.gnu.org/ml/gcc-patches/2012-06/msg00615.html Bootstrapped and regression tested on gcc110.fsffrance.org . Ok ? regards, Ramana * tree-vect-generic.c (lower_vec_perm): Propagate vector constants into VEC_PERM_EXPR.. diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c index 06334bb..3b9f561 100644 --- a/gcc/tree-vect-generic.c +++ b/gcc/tree-vect-generic.c @@ -628,6 +628,14 @@ lower_vec_perm (gimple_stmt_iterator *gsi) location_t loc = gimple_location (gsi_stmt (*gsi)); unsigned i; + if (TREE_CODE (mask) == SSA_NAME) + { + gimple def_stmt = SSA_NAME_DEF_STMT (mask); + if (is_gimple_assign (def_stmt) + && gimple_assign_rhs_code (def_stmt) == VECTOR_CST) + mask = gimple_assign_rhs1 (def_stmt); + } + if (TREE_CODE (mask) == VECTOR_CST) { unsigned char *sel_int = XALLOCAVEC (unsigned char, elements); @@ -637,7 +645,11 @@ lower_vec_perm (gimple_stmt_iterator *gsi) & (2 * elements - 1)); if (can_vec_perm_p (TYPE_MODE (vect_type), false, sel_int)) - return; + { + gimple_assign_set_rhs3 (stmt, mask); + update_stmt (stmt); + return; + } } else if (can_vec_perm_p (TYPE_MODE (vect_type), true, NULL)) return;