From patchwork Tue Nov 29 15:15:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Krebbel X-Patchwork-Id: 700581 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 3tSnDm5hCVz9t2T for ; Wed, 30 Nov 2016 02:15:49 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="ElfMRg1h"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:references:mime-version:content-type :in-reply-to:message-id; q=dns; s=default; b=BiUCZrvrEaUhH6NYSZ4 yjfjcjUIT4lLJCFLJReFRQyHGyY16i2CSStsqnINNdeWWna3ZPwdHqKvO041mcGS I2eswBBm5FnpoxRma5jKSstUiJmZXvT0LKUo2VFj/0aGa5Gm5S4qNBt7+Eb5xDGe p1MMsHeGiqt355i8AMOdbGCQ= 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:date :from:to:cc:subject:references:mime-version:content-type :in-reply-to:message-id; s=default; bh=rAFxkB2Yt6XDzt/fnOqSUYs9Q GQ=; b=ElfMRg1hFwqHvzJS2bV2vQhe2fAEf7JVlAeatJadMiUpkCUgHJAOMJQ1P nKBxJgZKoFcGZizby5uvyncmTfT5vm+HDpBfzcvZi4Zwbb7vflWV7eftrqCwcM6M NioHAaAd3g/rw1aXDc8DdAhmNRyOx5sdriBdZ3gXroh1vVJ0eI= Received: (qmail 38661 invoked by alias); 29 Nov 2016 15:15:40 -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 31616 invoked by uid 89); 29 Nov 2016 15:15:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW, RCVD_IN_SEMBACKSCATTER autolearn=no version=3.3.2 spammy=krebbellinuxvnetibmcom, krebbel@linux.vnet.ibm.com, mzarch, sk:s390_ex X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0a-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.156.1) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 29 Nov 2016 15:15:20 +0000 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id uATFESai086318 for ; Tue, 29 Nov 2016 10:15:18 -0500 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0a-001b2d01.pphosted.com with ESMTP id 271b7dkpyv-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 29 Nov 2016 10:15:18 -0500 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 29 Nov 2016 15:15:15 -0000 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 29 Nov 2016 15:15:14 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 6E6F41B08067; Tue, 29 Nov 2016 15:17:35 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id uATFEmg034734212; Tue, 29 Nov 2016 15:15:13 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 424E1A4089; Tue, 29 Nov 2016 14:13:26 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 30B1FA4092; Tue, 29 Nov 2016 14:13:24 +0000 (GMT) Received: from bart (unknown [9.152.212.134]) by d06av23.portsmouth.uk.ibm.com (Postfix) with SMTP; Tue, 29 Nov 2016 14:13:24 +0000 (GMT) Received: by bart (sSMTP sendmail emulation); Tue, 29 Nov 2016 16:15:12 +0100 Date: Tue, 29 Nov 2016 16:15:12 +0100 From: Andreas Krebbel To: Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH 4/4] S/390: Disable peeling for alignment. References: <20161129094247.19012-1-krebbel@linux.vnet.ibm.com> <20161129094247.19012-5-krebbel@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16112915-0016-0000-0000-00000272D709 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16112915-0017-0000-0000-000023FDACFD Message-Id: <20161129151512.GA28038@maggie> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-11-29_01:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1611290257 X-IsSubscribed: yes On Tue, Nov 29, 2016 at 11:38:15AM +0100, Richard Biener wrote: > So - please instead of setting this param provide > TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST. Right, that's way better. gcc/ChangeLog: 2016-11-29 Andreas Krebbel * gcc/config/s390/s390.c (s390_builtin_vectorization_cost): New function. (TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST): Define target macro. gcc/testsuite/ChangeLog: 2016-11-29 Andreas Krebbel * gcc.target/s390/vector/vec-nopeel-1.c: New test. --- gcc/config/s390/s390.c | 38 ++++++++++++++++++++++ .../gcc.target/s390/vector/vec-nopeel-1.c | 17 ++++++++++ 2 files changed, 55 insertions(+) create mode 100644 gcc/testsuite/gcc.target/s390/vector/vec-nopeel-1.c diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index dab4f43..82aca3f 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -3674,6 +3674,41 @@ s390_address_cost (rtx addr, machine_mode mode ATTRIBUTE_UNUSED, return ad.indx? COSTS_N_INSNS (1) + 1 : COSTS_N_INSNS (1); } +/* Implement targetm.vectorize.builtin_vectorization_cost. */ +static int +s390_builtin_vectorization_cost (enum vect_cost_for_stmt type_of_cost, + tree vectype, + int misalign ATTRIBUTE_UNUSED) +{ + switch (type_of_cost) + { + case scalar_stmt: + case scalar_load: + case scalar_store: + case vector_stmt: + case vector_load: + case vector_store: + case vec_to_scalar: + case scalar_to_vec: + case cond_branch_not_taken: + case vec_perm: + case vec_promote_demote: + return 1; + case unaligned_load: + case unaligned_store: + return 2; + + case cond_branch_taken: + return 3; + + case vec_construct: + return TYPE_VECTOR_SUBPARTS (vectype) - 1; + + default: + gcc_unreachable (); + } +} + /* If OP is a SYMBOL_REF of a thread-local symbol, return its TLS mode, otherwise return 0. */ @@ -15428,6 +15463,9 @@ s390_excess_precision (enum excess_precision_type type) #define TARGET_REGISTER_MOVE_COST s390_register_move_cost #undef TARGET_MEMORY_MOVE_COST #define TARGET_MEMORY_MOVE_COST s390_memory_move_cost +#undef TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST +#define TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST \ + s390_builtin_vectorization_cost #undef TARGET_MACHINE_DEPENDENT_REORG #define TARGET_MACHINE_DEPENDENT_REORG s390_reorg diff --git a/gcc/testsuite/gcc.target/s390/vector/vec-nopeel-1.c b/gcc/testsuite/gcc.target/s390/vector/vec-nopeel-1.c new file mode 100644 index 0000000..5f370a2 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/vector/vec-nopeel-1.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch -march=z13" } */ +/* { dg-require-effective-target vector } */ + +int +foo (int * restrict a, int n) +{ + int i, result = 0; + + for (i = 0; i < n * 4; i++) + result += a[i]; + return result; +} + +/* We do NOT want this loop to get peeled to reach better alignment. + Without peeling no scalar memory add should appear. */ +/* { dg-final { scan-assembler-not "\ta\t" } } */