From patchwork Mon Jun 24 06:00:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Jia He X-Patchwork-Id: 1121093 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-503545-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="l0fjRuuv"; dkim-atps=neutral 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 45XJZ01k8Sz9s7h for ; Mon, 24 Jun 2019 16:00:53 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; q=dns; s=default; b=cyBHs4wNxA+N 9JE4ZYUuTz9MWld7s02LXBtd43/rHhsmxoCofwWqe7BJIdmO5D2TKJcGz3GaSPLO fBZibULtdiui85f+zXgt13NHMVolYDlCc2zwCyTBL0sDZ0lkAMXWn+KHl13O8Q+d oou2jUxW7TrJ8wWjtAlKSpo2YpYwTm0= 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:from :to:cc:subject:date:message-id; s=default; bh=EBMm6iAb3Wu8BGvUKs OH7L1QygU=; b=l0fjRuuv5LRJQh6S9sr6SN9bBYgfYT3aqirTW7WfAQ2oxv1DK9 9XdJ8n+JeeesxIAoB6DICvu1gwjg8rtnBkwJIVXfVucs4VSUFb2TfXy4RcaF/f4l ss1qU6KYmiwbhhDOC/1YKdR9td16rU3aVXVEwhRWDXBiSvItWR7sYJOro= Received: (qmail 106634 invoked by alias); 24 Jun 2019 06:00:44 -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 106507 invoked by uid 89); 24 Jun 2019 06:00:32 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-27.6 required=5.0 tests=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.1 spammy=Jia, Power 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; Mon, 24 Jun 2019 06:00:22 +0000 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x5O5ui7p098007 for ; Mon, 24 Jun 2019 02:00:18 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2taqva21w1-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 24 Jun 2019 02:00:18 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 24 Jun 2019 07:00:15 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 24 Jun 2019 07:00:13 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x5O60CeY45744228 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Jun 2019 06:00:12 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D4B72A405D; Mon, 24 Jun 2019 06:00:08 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1FE43A4065; Mon, 24 Jun 2019 06:00:08 +0000 (GMT) Received: from genoa.aus.stglabs.ibm.com (unknown [9.40.192.157]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 24 Jun 2019 06:00:07 +0000 (GMT) From: Li Jia He To: gcc-patches@gcc.gnu.org Cc: segher@kernel.crashing.org, wschmidt@linux.ibm.com, Li Jia He Subject: [PATCH] [RS6000] Change maddld match_operand from DI to GPR Date: Mon, 24 Jun 2019 01:00:05 -0500 x-cbid: 19062406-0012-0000-0000-0000032BC9B5 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19062406-0013-0000-0000-00002164F8CF Message-Id: <1561356005-71785-1-git-send-email-helijia@linux.ibm.com> X-IsSubscribed: yes Hi, From PowerPC ISA3.0, the description of `maddld RT, RA.RB, RC` is as follows: 64-bit RA and RB are multiplied and then the RC is signed extend to 128 bits, and add them together. We only apply it to 64-bit mode (DI) when implementing maddld. However, if we can guarantee that the result of the maddld operation will be limited to 32-bit mode (SI), we can still apply it to 32-bit mode (SI). The regression testing for the patch was done on GCC mainline on powerpc64le-unknown-linux-gnu (Power 9 LE) with no regressions. Is it OK for trunk ? Thanks, Lijia He gcc/ChangeLog 2019-06-24 Li Jia He * config/rs6000/rs6000.h (TARGET_MADDLD): Remove the restriction of TARGET_POWERPC64. * config/rs6000/rs6000.md (maddld): Change maddld match_operand from DI to GPR. gcc/testsuite/ChangeLog 2019-06-24 Li Jia He * gcc.target/powerpc/maddld-1.c: New testcase. --- gcc/config/rs6000/rs6000.h | 2 +- gcc/config/rs6000/rs6000.md | 10 +++++----- gcc/testsuite/gcc.target/powerpc/maddld-1.c | 19 +++++++++++++++++++ 3 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/maddld-1.c diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index 34fa36b6ed9..f83f19afbba 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -453,7 +453,7 @@ extern int rs6000_vector_align[]; #define TARGET_FCTIWUZ TARGET_POPCNTD #define TARGET_CTZ TARGET_MODULO #define TARGET_EXTSWSLI (TARGET_MODULO && TARGET_POWERPC64) -#define TARGET_MADDLD (TARGET_MODULO && TARGET_POWERPC64) +#define TARGET_MADDLD TARGET_MODULO #define TARGET_XSCVDPSPN (TARGET_DIRECT_MOVE || TARGET_P8_VECTOR) #define TARGET_XSCVSPDPN (TARGET_DIRECT_MOVE || TARGET_P8_VECTOR) diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 47cbba89443..9122b29e99b 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -3057,11 +3057,11 @@ DONE; }) -(define_insn "*maddld4" - [(set (match_operand:DI 0 "gpc_reg_operand" "=r") - (plus:DI (mult:DI (match_operand:DI 1 "gpc_reg_operand" "r") - (match_operand:DI 2 "gpc_reg_operand" "r")) - (match_operand:DI 3 "gpc_reg_operand" "r")))] +(define_insn "*maddld4" + [(set (match_operand:GPR 0 "gpc_reg_operand" "=r") + (plus:GPR (mult:GPR (match_operand:GPR 1 "gpc_reg_operand" "r") + (match_operand:GPR 2 "gpc_reg_operand" "r")) + (match_operand:GPR 3 "gpc_reg_operand" "r")))] "TARGET_MADDLD" "maddld %0,%1,%2,%3" [(set_attr "type" "mul")]) diff --git a/gcc/testsuite/gcc.target/powerpc/maddld-1.c b/gcc/testsuite/gcc.target/powerpc/maddld-1.c new file mode 100644 index 00000000000..06f5f5774d4 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/maddld-1.c @@ -0,0 +1,19 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-require-effective-target powerpc_p9modulo_ok } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2" } */ + +int +s_madd (int a, int b, int c) +{ + return (a * b) + c; +} + +unsigned int +u_madd (unsigned int a, unsigned int b, unsigned int c) +{ + return (a * b) + c; +} + +/* { dg-final { scan-assembler-times "maddld " 2 } } */ +/* { dg-final { scan-assembler-not "mulld " } } */ +/* { dg-final { scan-assembler-not "add " } } */