From patchwork Wed Sep 23 08:49:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kyrylo Tkachov X-Patchwork-Id: 54026 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by patches.linaro.org (Postfix) with ESMTPS id 2FFDC22E14 for ; Wed, 23 Sep 2015 08:50:24 +0000 (UTC) Received: by lamf6 with SMTP id f6sf19815065lam.1 for ; Wed, 23 Sep 2015 01:50:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mailing-list:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:sender :delivered-to:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding:x-original-sender :x-original-authentication-results; bh=OaXrcU9lRV1e1DMmQvJ9i5EQOzdraFL1cIGIYYcrg2g=; b=NCu6SGEEAuvNMhaZNyjS90xNBQZH3GQQ3bofhImlJ2Dg3nVjHjoDW5PdFxGwhlFVRf Xbi6wq2CeoyLMn3cNJyoRzaSZaW5+FjDINM6bSDrNj1AV6vuOCC7HdIDruAzanOUCAZE KuBvDO11fnp5P7GvywP+nAhTEA09Dyxr6SxMKfsWl+V0vtwg8KH5x3813sn0NaV1erBx C8s17rmYGZl60xsXISMk7liFJ5T1/uEwFrym30tAhazchpIqINQ9sFB4OBBlyw4OR50f gQfLxSlPZnRi9ZgDJGPWgrTLJjdJq+Rf3/jWZf9y/fTsHEx97Gj/iJJX0y+hzx0YpXAL /BNQ== X-Gm-Message-State: ALoCoQmjy3vL1w54UBJKm4rgiHT+GxDFf6eCbd8aGgzCbcLr19nmMDOq4IdH8slzUTMOkhTYrWeg X-Received: by 10.180.210.212 with SMTP id mw20mr377448wic.3.1442998222786; Wed, 23 Sep 2015 01:50:22 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.23.1 with SMTP id i1ls7737laf.105.gmail; Wed, 23 Sep 2015 01:50:22 -0700 (PDT) X-Received: by 10.152.45.41 with SMTP id j9mr11008140lam.110.1442998222635; Wed, 23 Sep 2015 01:50:22 -0700 (PDT) Received: from mail-la0-x233.google.com (mail-la0-x233.google.com. [2a00:1450:4010:c03::233]) by mx.google.com with ESMTPS id rb7si1386938lbb.4.2015.09.23.01.50.22 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Sep 2015 01:50:22 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::233 as permitted sender) client-ip=2a00:1450:4010:c03::233; Received: by lacao8 with SMTP id ao8so18929357lac.3 for ; Wed, 23 Sep 2015 01:50:22 -0700 (PDT) X-Received: by 10.112.51.142 with SMTP id k14mr9315280lbo.76.1442998222466; Wed, 23 Sep 2015 01:50:22 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp958151lbq; Wed, 23 Sep 2015 01:50:21 -0700 (PDT) X-Received: by 10.66.235.42 with SMTP id uj10mr19587514pac.32.1442998221051; Wed, 23 Sep 2015 01:50:21 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id ck5si9046837pbb.91.2015.09.23.01.50.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Sep 2015 01:50:21 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-408088-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 94436 invoked by alias); 23 Sep 2015 08:50:05 -0000 Mailing-List: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org Precedence: list 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 90734 invoked by uid 89); 23 Sep 2015 08:50:04 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, SPF_PASS autolearn=ham version=3.3.2 X-HELO: eu-smtp-delivery-143.mimecast.com Received: from eu-smtp-delivery-143.mimecast.com (HELO eu-smtp-delivery-143.mimecast.com) (207.82.80.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 23 Sep 2015 08:50:01 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-10-umF8fSSEQ-C0VFK-TGZtrg-1; Wed, 23 Sep 2015 09:49:56 +0100 Received: from [10.2.207.50] ([10.1.2.79]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 23 Sep 2015 09:49:56 +0100 Message-ID: <560267B4.5070809@arm.com> Date: Wed, 23 Sep 2015 09:49:56 +0100 From: Kyrill Tkachov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Michael Collison , GCC Patches , Ramana Radhakrishnan Subject: Re: [ARM] Use vector wide add for mixed-mode adds References: <5601E9B9.5060600@linaro.org> In-Reply-To: <5601E9B9.5060600@linaro.org> X-MC-Unique: umF8fSSEQ-C0VFK-TGZtrg-1 X-IsSubscribed: yes X-Original-Sender: kyrylo.tkachov@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::233 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@gcc.gnu.org X-Google-Group-Id: 836684582541 Hi Michael, On 23/09/15 00:52, Michael Collison wrote: > This is a modified version of the previous patch that removes the > documentation and read-md.c fixes. These patches have been submitted > separately and approved. > > This patch is designed to address code that was not being vectorized due > to missing widening patterns in the ARM backend. Code such as: > > int t6(int len, void * dummy, short * __restrict x) > { > len = len & ~31; > int result = 0; > __asm volatile (""); > for (int i = 0; i < len; i++) > result += x[i]; > return result; > } > > Validated on arm-none-eabi, arm-none-linux-gnueabi, > arm-none-linux-gnueabihf, and armeb-none-linux-gnueabihf. > > 2015-09-22 Michael Collison > > * config/arm/neon.md (widen_sum): New patterns > where mode is VQI to improve mixed mode add vectorization. > Please list all the new define_expands and define_insns in the changelog. Also, please add an ChangeLog entry for the testsuite additions. The approach looks ok to me with a few comments on some parts of the patch itself. +(define_insn "vec_sel_widen_ssum_hi3" + [(set (match_operand: 0 "s_register_operand" "=w") + (plus: (sign_extend: (vec_select:VW (match_operand:VQI 1 "s_register_operand" "%w") + (match_operand:VQI 2 "vect_par_constant_high" ""))) + (match_operand: 3 "s_register_operand" "0")))] + "TARGET_NEON" + "vaddw.\t%q0, %q3, %f1" + [(set_attr "type" "neon_add_widen") + (set_attr "length" "8")] +) This is a single instruction, and it has a length of 4, so no need to override the length attribute. Same with the other define_insns in this patch. +/* { dg-final { scan-assembler "vaddw\.s16" } } */ + + + Stray trailing newlines. Similar comments for the other testcases. Thanks, Kyrill diff --git a/gcc/testsuite/gcc.target/arm/neon-vaddws16.c b/gcc/testsuite/gcc.target/arm/neon-vaddws16.c new file mode 100644 index 0000000..ed10669 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/neon-vaddws16.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_neon_hw } */ The arm_neon_hw check is usually used when you want to run the tests. Since this is a compile-only tests you just need arm_neon_ok. +/* { dg-add-options arm_neon_ok } */ +/* { dg-options "-O3" } */ + + +int +t6(int len, void * dummy, short * __restrict x) +{ + len = len & ~31; + int result = 0; + __asm volatile (""); + for (int i = 0; i < len; i++) + result += x[i]; + return result; +} +