From patchwork Tue Mar 7 21:36:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: will schmidt X-Patchwork-Id: 736367 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 3vd93J60MWz9sN6 for ; Wed, 8 Mar 2017 08:36:56 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="UBg6tQyW"; 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 :subject:from:to:cc:date:mime-version:content-type :content-transfer-encoding:message-id; q=dns; s=default; b=oxQpd y97HpIJyWrMfy+raNfGdDwrx7QZVKkvCGVEWI8c0fj7Au1xLOv5CeuQQc4KBoKH5 tQ3ctSx+JckoyICTz9FNfD79P3gE1U3eDw87i3ic835qXsxky9UHzXS+kFwdSlod cJaWWgGJ2eOrIyLzYRaQGErwc7mx7FKyonwBnk= 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 :subject:from:to:cc:date:mime-version:content-type :content-transfer-encoding:message-id; s=default; bh=jXs07qleKd1 fxfJgvBAUebGdsIc=; b=UBg6tQyWQfvC8+th/kelupWo09lWwVqjjlXqCDQuyxp O4lF9f3qawWxuYtKbs7o5u0ezxc3kK/iKsCkbGJvlTzYLVdTtQ+Dg3b5y2vAyI2G R85cDKu0UFioVmVnFWB4j/e/O1+bLteouABtZWFzeuTWUzmztSvbDUKXI9X+2ahs = Received: (qmail 15801 invoked by alias); 7 Mar 2017 21:36:47 -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 15749 invoked by uid 89); 7 Mar 2017 21:36:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=improperly 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, 07 Mar 2017 21:36:45 +0000 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v27LXj0h043978 for ; Tue, 7 Mar 2017 16:36:44 -0500 Received: from e18.ny.us.ibm.com (e18.ny.us.ibm.com [129.33.205.208]) by mx0a-001b2d01.pphosted.com with ESMTP id 29223cqgtu-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 07 Mar 2017 16:36:44 -0500 Received: from localhost by e18.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 7 Mar 2017 16:36:42 -0500 Received: from b03cxnp08027.gho.boulder.ibm.com (9.17.130.19) by e18.ny.us.ibm.com (146.89.104.205) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 7 Mar 2017 16:36:40 -0500 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v27LaUg111141560; Tue, 7 Mar 2017 14:36:39 -0700 Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D45AA6E038; Tue, 7 Mar 2017 14:36:39 -0700 (MST) Received: from brimstone.rchland.ibm.com (unknown [9.10.86.107]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP id 919DA6E03D; Tue, 7 Mar 2017 14:36:39 -0700 (MST) Received: from brimstone.rchland.ibm.com (brimstone.rchland.ibm.com [9.10.86.107]) by brimstone.rchland.ibm.com (Postfix) with ESMTP id B5CB31B60A10; Tue, 7 Mar 2017 15:36:38 -0600 (CST) Subject: [PATCH] [PATCH, rs6000] Fix pr79941 From: Will Schmidt To: gcc-patches@gcc.gnu.org, segher@kernel.crashing.org, wschmidt@linux.vnet.ibm.com Cc: will_schmidt@vnet.ibm.com Date: Tue, 07 Mar 2017 15:36:38 -0600 User-Agent: StGit/0.17.1-17-ge4e0476 MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 17030721-0044-0000-0000-000002BE4F5F X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006740; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000206; SDB=6.00831387; UDB=6.00407892; IPR=6.00608979; BA=6.00005194; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00014548; XFM=3.00000012; UTC=2017-03-07 21:36:42 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17030721-0045-0000-0000-000006EC5923 Message-Id: <20170307213638.26542.70346.stgit@brimstone.rchland.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-03-07_17:, , 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-1702020001 definitions=main-1703070169 X-IsSubscribed: yes Hi, Per PR79941, we are folding the vec_mul{e,o}* operations improperly. Those entries were added to the intrinsics-to-be-folded list where the generic multiplies should have been instead. Test coverage in place was for the generic multiplies, and this was missed by my testing. Thusly, remove those entries from the folding list. At the same time, I am adding a testcase to provide some basic coverage for those ops. Functional gimple folding for those operations will be showing up at a later time. OK for trunk? regtest is currently running on ppc64*. gcc: 2017-03-07 Will Schmidt PR middle-end/79941 * config/rs6000/rs6000.c (gimplify_init_constructor): Remove multiply even and multiply odd (vmule/vmulo) intrinsics from the multiply folding sequence. testsuite: 2017-03-07 Will Schmidt PR middle-end/79941 * gcc.target/powerpc/fold-vec-mult-even_odd_misc.c: New test. --- gcc/config/rs6000/rs6000.c | 31 ----------- .../powerpc/fold-vec-mult-even_odd_misc.c | 58 ++++++++++++++++++++ 2 files changed, 58 insertions(+), 31 deletions(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/fold-vec-mult-even_odd_misc.c diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 25b10f1..ce0ece5 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -16852,37 +16852,6 @@ rs6000_gimple_fold_builtin (gimple_stmt_iterator *gsi) gsi_replace (gsi, g, true); return true; } - /* Even element flavors of vec_mul (signed). */ - case ALTIVEC_BUILTIN_VMULESB: - case ALTIVEC_BUILTIN_VMULESH: - /* Even element flavors of vec_mul (unsigned). */ - case ALTIVEC_BUILTIN_VMULEUB: - case ALTIVEC_BUILTIN_VMULEUH: - { - arg0 = gimple_call_arg (stmt, 0); - arg1 = gimple_call_arg (stmt, 1); - lhs = gimple_call_lhs (stmt); - gimple *g = gimple_build_assign (lhs, VEC_WIDEN_MULT_EVEN_EXPR, arg0, arg1); - gimple_set_location (g, gimple_location (stmt)); - gsi_replace (gsi, g, true); - return true; - } - /* Odd element flavors of vec_mul (signed). */ - case ALTIVEC_BUILTIN_VMULOSB: - case ALTIVEC_BUILTIN_VMULOSH: - /* Odd element flavors of vec_mul (unsigned). */ - case ALTIVEC_BUILTIN_VMULOUB: - case ALTIVEC_BUILTIN_VMULOUH: - { - arg0 = gimple_call_arg (stmt, 0); - arg1 = gimple_call_arg (stmt, 1); - lhs = gimple_call_lhs (stmt); - gimple *g = gimple_build_assign (lhs, VEC_WIDEN_MULT_ODD_EXPR, arg0, arg1); - gimple_set_location (g, gimple_location (stmt)); - gsi_replace (gsi, g, true); - return true; - } - default: break; } diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-mult-even_odd_misc.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-mult-even_odd_misc.c new file mode 100644 index 0000000..583539e --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-mult-even_odd_misc.c @@ -0,0 +1,58 @@ + +/* { dg-do run } */ +/* { dg-require-effective-target powerpc_vsx_ok } */ +/* { dg-options "-maltivec -mvsx -O2 -save-temps" } */ + +#include + +__attribute__((noinline)) void +test_eub_char () +{ + vector unsigned char v0 = {1, 0, 0, 0, 0, 0, 0, 0}; + vector unsigned char v1 = {0xff, 0, 0, 0, 0, 0, 0, 0}; + vector unsigned short res = vec_vmuleub (v0, v1); + if (res[0] != (unsigned short)v0[0] * (unsigned short)v1[0]) + __builtin_abort (); +} +__attribute__((noinline)) void +test_oub_char () +{ + vector unsigned char v0 = {0, 1, 0, 0, 0, 0, 0, 0}; + vector unsigned char v1 = {0, 0xff, 0, 0, 0, 0, 0, 0}; + vector unsigned short res = vec_vmuloub (v0, v1); + if (res[0] != (unsigned short)v0[1] * (unsigned short)v1[1]) + __builtin_abort (); +} + +__attribute__((noinline)) void +test_euh_short () +{ + vector unsigned short v0 = {1, 0, 0, 0}; + vector unsigned short v1 = {0xff, 0, 0, 0}; + vector unsigned int res = vec_vmuleuh (v0, v1); + if (res[0] != (unsigned int)v0[0] * (unsigned int)v1[0]) + __builtin_abort (); +} +__attribute__((noinline)) void +test_ouh_short () +{ + vector unsigned short v0 = {0, 1, 0, 0}; + vector unsigned short v1 = {0, 0xff, 0, 0}; + vector unsigned int res = vec_vmulouh (v0, v1); + if (res[0] != (unsigned int)v0[1] * (unsigned int)v1[1]) + __builtin_abort (); +} + +int main () +{ + test_eub_char(); + test_oub_char(); + test_euh_short(); + test_ouh_short(); +} + +/* { dg-final { scan-assembler-times "vmuleub" 1 } } */ +/* { dg-final { scan-assembler-times "vmuloub" 1 } } */ +/* { dg-final { scan-assembler-times "vmuleuh" 1 } } */ +/* { dg-final { scan-assembler-times "vmulouh" 1 } } */ +