From patchwork Wed Apr 9 02:40:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cong Hou X-Patchwork-Id: 337767 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id B79DC1400A7 for ; Wed, 9 Apr 2014 12:40:35 +1000 (EST) 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:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; q=dns; s=default; b=nnh5qrzfuvNZjZL16l 6PrkQD5dCb5IAUKvoWeMf4lbjBe0870saQy6dy2tkORjPM39JBTdtSkLetrga1b+ mXxvggys20tCddBR09lFBUeO6UwQc9Jcov8Oy+SvKo2i/tk56eW4zfyozN0JAhmo WDp4BT7v0keS9VTCIkxtkB+Kg= 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:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; s=default; bh=g7algdeDUtyoM+T9YXmHKNhh 7rc=; b=uQnLYxkYTT1lwV2f+hsQT6a+FFMcTZ449iqLmI79UWKwIJmfA5DvFJDh 4f3O8Yr0UswiQJKJ5BmL1ntXDK/xpMHukXCPvq5wtBBhSpSqgnfbKdwZ4cOQ2vHh OPUEMduA+I3dKGpOD0D3oSB7NFtzRaj8N3FBeQtPo3yfr3AVHzI= Received: (qmail 27106 invoked by alias); 9 Apr 2014 02:40:25 -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 27020 invoked by uid 89); 9 Apr 2014 02:40:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ie0-f172.google.com Received: from mail-ie0-f172.google.com (HELO mail-ie0-f172.google.com) (209.85.223.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 09 Apr 2014 02:40:22 +0000 Received: by mail-ie0-f172.google.com with SMTP id as1so1876185iec.31 for ; Tue, 08 Apr 2014 19:40:20 -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:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=hJ5zFGvJK5jyRyNQ0QVst7G2QUQwQ5+b0Rosfd3Iozs=; b=WB4NOfGfxRGmZ5NuFP2Wr4vFPuTyqwszaeR/qE18qJpYrh+ZpoLi+Dd2pLsa2pufH+ CaoUxtxE3lx9UKZb1TsCJNcSRC+RTrkI9i3fKeEJu1lp4iaebQPCIxwQzsh4zpPGkicN 2LNEcKx310F3W1hGcSZridYbfGvTvmVbsynbmGOTn6K4IsG71P682eXo1V2Rgoo8nabe TfQ1mPdEXjujKX9ghqt0gKRNt0WfVmGzGe4vhZFpTlMIMlW1SArpLJ8MLA+QzIQIYU5p 44Azow3gPvdqTo6ljA0DGgVFu2/IfDvNO9+Jx/yL2MHRddApqMid6T2cbgs56do/DWgk gt5A== X-Gm-Message-State: ALoCoQkIzCLxLSJ3vaf+QpPL+e6WGDA/biGfEHe/jWErhl65iM7BK2RhP0hJvP6sL4Y3SCpgEU0ObMeJMnc/UeVb9qfdKSs3qKIxcl8N+E1i/bjoyVyQ8II3ZYyoXoYQr7Uae7ZU+w86Qucx7rlHp7cfPjUy49KVpIvcnTxfBmvQM81833WdtB0vfe5u8+Ij/vHa/nY1bz047PjazJHQtCLWQI91tzDJ4A== MIME-Version: 1.0 X-Received: by 10.50.9.71 with SMTP id x7mr7835603iga.45.1397011220270; Tue, 08 Apr 2014 19:40:20 -0700 (PDT) Received: by 10.64.7.225 with HTTP; Tue, 8 Apr 2014 19:40:20 -0700 (PDT) In-Reply-To: References: Date: Tue, 8 Apr 2014 19:40:20 -0700 Message-ID: Subject: Re: Fixing PR60773 From: Cong Hou To: Rainer Orth Cc: GCC Patches , Richard Biener Thanks for the comments, and the attached file is the updated patch. thanks, Cong On Tue, Apr 8, 2014 at 12:28 AM, Rainer Orth wrote: > Cong Hou writes: > >> In the patch of >> PR60656(http://gcc.gnu.org/ml/gcc-patches/2014-03/msg01668.html), the >> test case requires GCC to vectorize the widen-mult pattern from si to >> di types. This may result in test failures on some platforms that >> don't support this pattern. This patch adds a new target >> vect_widen_mult_si_to_di_pattern to fix this issue. > > Please document the new keyword in gcc/doc/sourcebuild.texi. > >> diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog >> index 414a745..ea860e7 100644 >> --- a/gcc/testsuite/ChangeLog >> +++ b/gcc/testsuite/ChangeLog >> @@ -1,3 +1,11 @@ >> +2014-04-07 Cong Hou >> + >> + PR testsuite/60773 >> + * testsuite/lib/target-supports.exp: >> + Add check_effective_target_vect_widen_mult_si_to_di_pattern. >> + * gcc.dg/vect/pr60656.c: Update the test by checking if the targets >> + vect_widen_mult_si_to_di_pattern and vect_long are supported. >> + > > Your mailer is broken: it swallows tabs and breaks long lines. If you > can't fix it, please attach patches instead of sending them inline. > > Thanks. > > Rainer > > -- > ----------------------------------------------------------------------------- > Rainer Orth, Center for Biotechnology, Bielefeld University diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index 85ef819..9148608 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -1428,6 +1428,10 @@ Target supports a vector widening multiplication of @code{short} operands into @code{int} results, or can promote (unpack) from @code{short} to @code{int} and perform non-widening multiplication of @code{int}. +@item vect_widen_mult_si_to_di_pattern +Target supports a vector widening multiplication of @code{int} operands +into @code{long} results. + @item vect_sdot_qi Target supports a vector dot-product of @code{signed char}. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 414a745..d426e29 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2014-04-07 Cong Hou + + PR testsuite/60773 + * lib/target-supports.exp: + Add check_effective_target_vect_widen_mult_si_to_di_pattern. + * gcc.dg/vect/pr60656.c: Update the test by checking if the targets + vect_widen_mult_si_to_di_pattern and vect_long are supported. + 2014-03-28 Cong Hou PR tree-optimization/60656 diff --git a/gcc/testsuite/gcc.dg/vect/pr60656.c b/gcc/testsuite/gcc.dg/vect/pr60656.c index ebaab62..4950275 100644 --- a/gcc/testsuite/gcc.dg/vect/pr60656.c +++ b/gcc/testsuite/gcc.dg/vect/pr60656.c @@ -1,4 +1,5 @@ /* { dg-require-effective-target vect_int } */ +/* { dg-require-effective-target vect_long } */ #include "tree-vect.h" @@ -12,7 +13,7 @@ foo () for(i = 0; i < 4; ++i) { long P = v[i]; - s += P*P*P; + s += P * P * P; } return s; } @@ -27,7 +28,7 @@ bar () for(i = 0; i < 4; ++i) { long P = v[i]; - s += P*P*P; + s += P * P * P; __asm__ volatile (""); } return s; @@ -35,11 +36,12 @@ bar () int main() { + check_vect (); + if (foo () != bar ()) abort (); return 0; } -/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_widen_mult_si_to_di_pattern } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ - diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index bee8471..6d9d689 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -3732,6 +3732,27 @@ proc check_effective_target_vect_widen_mult_hi_to_si_pattern { } { } # Return 1 if the target plus current options supports a vector +# widening multiplication of *int* args into *long* result, 0 otherwise. +# +# This won't change for different subtargets so cache the result. + +proc check_effective_target_vect_widen_mult_si_to_di_pattern { } { + global et_vect_widen_mult_si_to_di_pattern + + if [info exists et_vect_widen_mult_si_to_di_pattern_saved] { + verbose "check_effective_target_vect_widen_mult_si_to_di_pattern: using cached result" 2 + } else { + if {[istarget ia64-*-*] + || [istarget i?86-*-*] + || [istarget x86_64-*-*] } { + set et_vect_widen_mult_si_to_di_pattern_saved 1 + } + } + verbose "check_effective_target_vect_widen_mult_si_to_di_pattern: returning $et_vect_widen_mult_si_to_di_pattern_saved" 2 + return $et_vect_widen_mult_si_to_di_pattern_saved +} + +# Return 1 if the target plus current options supports a vector # widening shift, 0 otherwise. # # This won't change for different subtargets so cache the result.