From patchwork Fri Sep 16 15:13:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Schmidt X-Patchwork-Id: 670946 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 3sbJhQ49vqz9snm for ; Sat, 17 Sep 2016 01:13:40 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=ryIOdCVZ; 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:to:cc :from:subject:date:mime-version:content-type :content-transfer-encoding:message-id; q=dns; s=default; b=Xey6g 30OTy7LbBBSAUXu7ujOwjO/Y74VCWg+8W6pnf9RK6055NNzd464kOSEI5GvDODWC wAfu3XNVLk7WpUdA/pgMM0X6rUSiHy5fYsmZi3ECaQM/JeKaoTNySQHEPXxHzVlN 2w7dC4hD8i9r/xfHc1Ww1rkC9aUAPG9Wb17BLw= 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:to:cc :from:subject:date:mime-version:content-type :content-transfer-encoding:message-id; s=default; bh=ntYfq5sckY4 ++KYjgpVMOAErT6M=; b=ryIOdCVZM5Gr/keoN/51KNub9IrJ6mvsUI/HabDlrRq pJQYhACe4Ujd3PvZ2wnZuP/U+k6RwGcYAQH6zY7cljLs0MHJdqQqvY+SC2rymsYp yKzdY1NBw/ugB8EavB3VXnIvVCjyXnFF+Cx3g/g+p0AWcfOZclI/8saOzen0v+o0 = Received: (qmail 41445 invoked by alias); 16 Sep 2016 15:13:29 -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 41416 invoked by uid 89); 16 Sep 2016 15:13:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.8 required=5.0 tests=BAYES_00, KAM_ASCII_DIVIDERS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy= 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; Fri, 16 Sep 2016 15:13:17 +0000 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u8GF7pU4100416 for ; Fri, 16 Sep 2016 11:13:16 -0400 Received: from e32.co.us.ibm.com (e32.co.us.ibm.com [32.97.110.150]) by mx0a-001b2d01.pphosted.com with ESMTP id 25fu1fwefa-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 16 Sep 2016 11:13:15 -0400 Received: from localhost by e32.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 16 Sep 2016 09:13:14 -0600 Received: from d03dlp03.boulder.ibm.com (9.17.202.179) by e32.co.us.ibm.com (192.168.1.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 16 Sep 2016 09:13:11 -0600 Received: from b03cxnp08028.gho.boulder.ibm.com (b03cxnp08028.gho.boulder.ibm.com [9.17.130.20]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id E04A519D8040; Fri, 16 Sep 2016 09:12:40 -0600 (MDT) Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp08028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u8GFDB1R3932430; Fri, 16 Sep 2016 08:13:11 -0700 Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 39F6B78037; Fri, 16 Sep 2016 09:13:11 -0600 (MDT) Received: from BigMac.local (unknown [9.80.220.151]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTP id AFC0F78043; Fri, 16 Sep 2016 09:13:10 -0600 (MDT) To: GCC Patches Cc: Segher Boessenkool , David Edelsohn , anton@samba.org From: Bill Schmidt Subject: [PATCH, rs6000] Fix PR77613 (swap optimization for splat-with-truncate) Date: Fri, 16 Sep 2016 10:13:09 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16091615-0004-0000-0000-000010675573 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00005771; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000185; SDB=6.00758344; UDB=6.00359929; IPR=6.00532049; BA=6.00004731; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00012693; XFM=3.00000011; UTC=2016-09-16 15:13:13 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16091615-0005-0000-0000-000078F58AEC Message-Id: <16ba332c-9a8a-f9f8-5672-96efc7f07d55@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-09-16_09:, , 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-1609020000 definitions=main-1609160193 X-IsSubscribed: yes Hi, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77613 identifies a case where we fail to remove swaps from a region because it contains a form of splat that we don't yet recognize. This patch adds support for splat insns that have an embedded truncate, such as the vsx_vsplth_di pattern. Bootstrapped and tested on powerpc64le-unknown-linux-gnu with no regressions. Ok for trunk, and eventual backport to 6 and 5 branches? Thanks, Bill [gcc] 2016-09-16 Bill Schmidt PR target/77613 * config/rs6000/rs6000.c (rtx_is_swappable_p): Add support for splat with truncate. [gcc/testsuite] 2016-09-16 Bill Schmidt PR target/77613 * gcc.target/powerpc/swaps-p8-25.c: New. Index: gcc/config/rs6000/rs6000.c =================================================================== --- gcc/config/rs6000/rs6000.c (revision 240187) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -39105,6 +39105,11 @@ rtx_is_swappable_p (rtx op, unsigned int *special) && GET_MODE_INNER (GET_MODE (op)) == GET_MODE (XEXP (op, 0))) /* This catches V2DF and V2DI splat, at a minimum. */ return 1; + else if (GET_CODE (XEXP (op, 0)) == TRUNCATE + && GET_CODE (XEXP (XEXP (op, 0), 0)) == REG + && GET_MODE_INNER (GET_MODE (op)) == GET_MODE (XEXP (op, 0))) + /* This catches splat of a truncated value. */ + return 1; else if (GET_CODE (XEXP (op, 0)) == VEC_SELECT) /* If the duplicated item is from a select, defer to the select processing to see if we can change the lane for the splat. */ Index: gcc/testsuite/gcc.target/powerpc/swaps-p8-25.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/swaps-p8-25.c (revision 0) +++ gcc/testsuite/gcc.target/powerpc/swaps-p8-25.c (working copy) @@ -0,0 +1,18 @@ +/* { dg-do compile { target { powerpc64le-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-options "-mcpu=power8 -O3 " } */ +/* { dg-final { scan-assembler "lxvd2x" } } */ +/* { dg-final { scan-assembler "stxvd2x" } } */ +/* { dg-final { scan-assembler-not "xxpermdi" } } */ + +/* Verify that swap optimization works correctly for a truncating splat. */ + +/* Test case to resolve PR77613. */ + +void pr77613 (signed short a, signed short *x, signed short *y) +{ + unsigned long i; + + for (i = 0; i < 1024; i++) + y[i] = a * x[i] + y[i]; +}