From patchwork Mon Apr 7 19:16:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cong Hou X-Patchwork-Id: 337514 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 88769140079 for ; Tue, 8 Apr 2014 05:16:23 +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:date:message-id:subject:from:to:cc:content-type; q=dns; s=default; b=mC8og8259b5Q1vl2kwrRZmMd4ZFJtbrbiBPpYUGwYhn VbLAJgXazp1TY+cpO4H6HfXVxWvWLkbnaxNQN3HruvjXBRF/oI2afWZUCsByiVDb /4eM7IGr1xygxzBxFART0PkoR/C/QDbwDg8Xl5L+/NftFMjrr/0bUJT+TJ+9JrEU = 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=FwpGRPaaHim+leTEAKW6SeLliHA=; b=pnEfVMRhP0HLWwbLi CyThsvSBnRu8Ua7tVmb6g/RnrhCC2/dwBOotuk76TYp9qPIDyZ4k+umJ31BKIDil ZoVMBawke5pM8qQaPhI6NRyAla9N2L3ErHaa2C5KP8laoq2gP/RUrJ5SUdR6GlMV qzyFIJFVPz/WB0c0/EACDHtv7U= Received: (qmail 18788 invoked by alias); 7 Apr 2014 19:16:16 -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 18773 invoked by uid 89); 7 Apr 2014 19:16:16 -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-ig0-f180.google.com Received: from mail-ig0-f180.google.com (HELO mail-ig0-f180.google.com) (209.85.213.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 07 Apr 2014 19:16:14 +0000 Received: by mail-ig0-f180.google.com with SMTP id c1so71678igq.13 for ; Mon, 07 Apr 2014 12:16:12 -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 :content-type; bh=Wws7zcq/pgUVb7PBN97ugUK8k1EoIsx5keK0OgpxZ4Y=; b=U+UyrI1r2hkOXKjfWzrowZF+tSx6SHdlB7gz34d2jcmGNMac8RgUNfZja6gvSMgz6J 4AXyiEv4sWaaUrnIYgGKZpDVeUMxpDmGXuI8uQDMx0Rb+9kJcNq3fPdpLOwRvu26AxJp Ub0njlWSIUyuaT4P7iJeQmjk4M/XFhK6LTDXUWoNZlbU9W3onpEnECdIDo60Xqgqsm9P C3dFmMe2SFtmjMq3MzWpmAlIldz0rxNR0IcyPPWCSE0vucLPpZaVfsP+1zl5YRydCuG7 0RW/Q7e3kgXdpoJqxhCtP9BW1aAonF5Mlyls19T8T6xiGBfVbm99S6XozS+T+bVYwGRw QT9w== X-Gm-Message-State: ALoCoQmv/i+OlYLld0cFBOEBy6pFHgcbjcwgI+vsqnHF5oDi+SJBiXexQiswpckY3Rktuav+5hisDZNSGnmQK4K9IOykVE9KDOXDQ+CT95Ow7cg4FqHL1I+eJWUMGRenT84Gv8wUfHzbqum9oKlRTOim7h9TRd3z5Igr2uAryDds1vKX+huzUudwQg1uGnFXKPZxNtRf1tGlOo4cdxpuarTV+zyccOBorg== MIME-Version: 1.0 X-Received: by 10.43.152.14 with SMTP id ku14mr755725icc.60.1396898172789; Mon, 07 Apr 2014 12:16:12 -0700 (PDT) Received: by 10.64.7.225 with HTTP; Mon, 7 Apr 2014 12:16:12 -0700 (PDT) Date: Mon, 7 Apr 2014 12:16:12 -0700 Message-ID: Subject: Fixing PR60773 From: Cong Hou To: GCC Patches Cc: Richard Biener 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. Bootstrapped and tested on x86_64. OK for trunk? thanks, Cong +# 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. 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. + 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..b80e008 100644 --- a/gcc/testsuite/gcc.dg/vect/pr60656.c +++ b/gcc/testsuite/gcc.dg/vect/pr60656.c @@ -1,5 +1,7 @@ /* { dg-require-effective-target vect_int } */ +/* { dg-require-effective-target vect_long } */ +#include #include "tree-vect.h" __attribute__ ((noinline)) long @@ -12,7 +14,7 @@ foo () for(i = 0; i < 4; ++i) { long P = v[i]; - s += P*P*P; + s += P * P * P; } return s; } @@ -27,7 +29,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 +37,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 +} +