From patchwork Fri May 20 02:13:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kugan Vivekanandarajah X-Patchwork-Id: 68218 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp3521706qge; Thu, 19 May 2016 19:13:48 -0700 (PDT) X-Received: by 10.66.229.33 with SMTP id sn1mr844624pac.49.1463710428931; Thu, 19 May 2016 19:13:48 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id cw8si24133526pad.96.2016.05.19.19.13.48 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 May 2016 19:13:48 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-427845-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-427845-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-427845-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:cc:content-type; q=dns; s=default; b=bOwqosoiBPyqEng4v9ALVJ+Ghrz1HUW3YtZuNz0FqDS va643Yig0pgggI09sQAquB0aJQeZcDMzLTFpjnSlDCojs8CYImNSdh9//KKECJaa XiyixLsKMLNjATOmlaskPwclnReNDtLfrNafVlO4GBKlUM67krHHpQNdq4J2WtkQ = 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 :mime-version:date:message-id:subject:from:to:cc:content-type; s=default; bh=zepKju33WBpN94y+6Nk+vkluXcM=; b=gk7LlSpNlybgrfw3R n8v6tl41COJpqqsLBARv9VL66DtYooythhSYIA0Z+R1yXqpqNii8dmCww/IFLd1R NJvPbUJU8fUOkGNWOpYSR3DtTANyHqbIwTSATN8rH2fAjm3Hh7NtVZdxAhgc0v/E TdiTy5PkuwPR1oNiGzD4wyxIlQ= Received: (qmail 121740 invoked by alias); 20 May 2016 02:13:32 -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 121723 invoked by uid 89); 20 May 2016 02:13:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=2016-05-20, 20160520 X-HELO: mail-qg0-f48.google.com Received: from mail-qg0-f48.google.com (HELO mail-qg0-f48.google.com) (209.85.192.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 20 May 2016 02:13:21 +0000 Received: by mail-qg0-f48.google.com with SMTP id 90so53764243qgz.1 for ; Thu, 19 May 2016 19:13:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to:cc; bh=+NDyBF3IKEaDnkWWCE8bzQR/s6Pvqpm+TpPxQTGOmhQ=; b=C1LGSR8+XjfjGFkr3s6PVsKUjLIG0ZAwNWLOTXLec4esIGNr2maOMYS0SmnudGrskK 778ZqJjYKEcGzu6pYaE5QXT6AnbPBXmfwDEImVVjstkFxqpSo+9le/q/xA9s62kr9gvq 2JdvXA2+eQH9DeHPh+WG8TZ5TuULrS53KGL3pdDy0ZcgpdAFoMdAaSuf6iiBtHtEHfYV /Paj2RUz6ryA3dCg02VUL6JZzjAaauQQRpo/yprPikBagAagDPU/DulUxQFFPPL3qkm8 HhmHbXWs2GoZN8yhjxm6p4lmnl6OYpPkylk+2K6+uwmu4E6C5prh99HGumASFlDX1ZSF M4xQ== X-Gm-Message-State: AOPr4FVizZBunJ/VOtk5sVkUfDmN2dz0a0f4Al2Cyzms1OGm9sDQffj8oG2CQMvyZ9arLNuTUJbM+HQJqNTgw2lA MIME-Version: 1.0 X-Received: by 10.140.161.4 with SMTP id h4mr503955qhh.99.1463710399577; Thu, 19 May 2016 19:13:19 -0700 (PDT) Received: by 10.200.42.71 with HTTP; Thu, 19 May 2016 19:13:19 -0700 (PDT) Date: Fri, 20 May 2016 12:13:19 +1000 Message-ID: Subject: [PATCH] Fix PR tree-optimization/71179 From: Kugan Vivekanandarajah To: "gcc-patches@gcc.gnu.org" Cc: Richard Biener X-IsSubscribed: yes Hi, We don’t allow vector type for integer. Likewise I am also disallowing the floating point vector type in transforming repeated addition to multiplication. This can be relaxed. I will send a separate patch to allow integer and floating point vectorization later. Bootstrapped and regression tested on x86-64-linux-gnu with no new regressions. Is this OK for trunk? Thanks, Kugan gcc/testsuite/ChangeLog: 2016-05-20 Kugan Vivekanandarajah * gcc.dg/tree-ssa/pr71179.c: New test. gcc/ChangeLog: 2016-05-20 Kugan Vivekanandarajah * tree-ssa-reassoc.c (transform_add_to_multiply): Disallow float VECTOR type. diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr71179.c b/gcc/testsuite/gcc.dg/tree-ssa/pr71179.c index e69de29..885c643 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr71179.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr71179.c @@ -0,0 +1,10 @@ + +/* { dg-do compile } */ +/* { dg-options "-O3 -ffast-math" } */ + +typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__)); + +__m128 foo (__m128 a) +{ + return a + a; +} diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index 3b5f36b..0c25a8c 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c @@ -1769,7 +1769,8 @@ transform_add_to_multiply (gimple *stmt, vec *ops) bool changed = false; if (!INTEGRAL_TYPE_P (TREE_TYPE ((*ops)[0]->op)) - && !flag_unsafe_math_optimizations) + && (!SCALAR_FLOAT_TYPE_P (TREE_TYPE ((*ops)[0]->op)) + || !flag_unsafe_math_optimizations)) return false; /* Look for repeated operands. */