From patchwork Wed Oct 25 14:38:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: will schmidt X-Patchwork-Id: 830309 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-465086-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="wgO2sl7f"; 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 3yMXp94pDPz9t2M for ; Thu, 26 Oct 2017 01:39:12 +1100 (AEDT) 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:reply-to:to:cc:content-type:date:mime-version :content-transfer-encoding:message-id; q=dns; s=default; b=gqMQt eGmhJR9uEkuv+aaozIpcMMYvdRxN7VqpLGnEVAPsbjcExiKqn8UImwgEbWOjxAGL reW9HCiON+/9JxRr6gAnIsXSzEddRW8Cl0KT9nltlbWs66WSqW1OCAehVnnSPjIw RXV8VyyUBX9TB6Plae1806/yhgvl5E5jH6psjg= 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:reply-to:to:cc:content-type:date:mime-version :content-transfer-encoding:message-id; s=default; bh=F+/xruFVOu3 /DKzql9500ILJ3U4=; b=wgO2sl7fIiY3fsw272VvM/SK4f6WrRg/3yvfV2MjIlV PZNepKu/hvbRSQz/qq4p0V9rJNAyYw2bcCvNAvFGf0f5Qqip4ttTPiu2DgAwchX1 hzRLkOaDS3PEriNwleNebmL9n1RQDC1zKZXoBLfXLeahLvCUG7bYy5tdXtmUp/ng = Received: (qmail 85500 invoked by alias); 25 Oct 2017 14:39:03 -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 85080 invoked by uid 89); 25 Oct 2017 14:39:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.8 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=Integral X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0b-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.158.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 25 Oct 2017 14:39:00 +0000 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v9PEXdGY028156 for ; Wed, 25 Oct 2017 10:38:55 -0400 Received: from e12.ny.us.ibm.com (e12.ny.us.ibm.com [129.33.205.202]) by mx0b-001b2d01.pphosted.com with ESMTP id 2dtu63n5pb-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 25 Oct 2017 10:38:55 -0400 Received: from localhost by e12.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 25 Oct 2017 10:38:54 -0400 Received: from b01cxnp23034.gho.pok.ibm.com (9.57.198.29) by e12.ny.us.ibm.com (146.89.104.199) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 25 Oct 2017 10:38:52 -0400 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp23034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v9PEcp0G40697882; Wed, 25 Oct 2017 14:38:51 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DE77EB204E; Wed, 25 Oct 2017 10:36:05 -0400 (EDT) Received: from [9.10.86.107] (unknown [9.10.86.107]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP id 992E6B204D; Wed, 25 Oct 2017 10:36:05 -0400 (EDT) Subject: [PATCH, rs6000] Gimple folding for vec_madd() From: Will Schmidt Reply-To: will_schmidt@vnet.ibm.com To: GCC Patches Cc: Segher Boessenkool , Richard Biener , Bill Schmidt , David Edelsohn Date: Wed, 25 Oct 2017 09:38:50 -0500 Mime-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 17102514-0048-0000-0000-000001FAF335 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007948; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000239; SDB=6.00936284; UDB=6.00471796; IPR=6.00716549; BA=6.00005660; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017707; XFM=3.00000015; UTC=2017-10-25 14:38:54 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17102514-0049-0000-0000-000042FA83AC Message-Id: <1508942330.26707.184.camel@brimstone.rchland.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-10-25_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-1707230000 definitions=main-1710250196 X-IsSubscribed: yes Hi, Add support for gimple folding of the vec_madd() (vector multiply-add) intrinsics. Testcase coverage is provided by the existing tests gcc.target/powerpc/fold-vec-madd-*.c Sniff-tests appear clean. A full regtest is currently running across assorted Power systems. (P6-P9). OK for trunk (pending clean run results)? Thanks, -Will [gcc] 2017-10-25 Will Schmidt * config/rs6000/rs6000.c: (rs6000_gimple_fold_builtin) Add support for gimple folding of vec_madd() intrinsics. diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 4837e14..04c2b15 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -16606,10 +16606,43 @@ rs6000_gimple_fold_builtin (gimple_stmt_iterator *gsi) build_int_cst (arg2_type, 0)), arg0); gimple_set_location (g, loc); gsi_replace (gsi, g, true); return true; } + + /* vec_madd (Float) */ + case ALTIVEC_BUILTIN_VMADDFP: + case VSX_BUILTIN_XVMADDDP: + { + arg0 = gimple_call_arg (stmt, 0); + arg1 = gimple_call_arg (stmt, 1); + tree arg2 = gimple_call_arg (stmt, 2); + lhs = gimple_call_lhs (stmt); + gimple *g = gimple_build_assign (lhs, FMA_EXPR , arg0, arg1, arg2); + gimple_set_location (g, gimple_location (stmt)); + gsi_replace (gsi, g, true); + return true; + } + /* vec_madd (Integral) */ + case ALTIVEC_BUILTIN_VMLADDUHM: + { + arg0 = gimple_call_arg (stmt, 0); + arg1 = gimple_call_arg (stmt, 1); + tree arg2 = gimple_call_arg (stmt, 2); + lhs = gimple_call_lhs (stmt); + tree lhs_type = TREE_TYPE (lhs); + location_t loc = gimple_location (stmt); + gimple_seq stmts = NULL; + tree mult_result = gimple_build (&stmts, loc, MULT_EXPR, + lhs_type, arg0, arg1); + tree plus_result = gimple_build (&stmts, loc, PLUS_EXPR, + lhs_type, mult_result, arg2); + gsi_insert_seq_before (gsi, stmts, GSI_SAME_STMT); + update_call_from_tree (gsi, plus_result); + return true; + } + default: if (TARGET_DEBUG_BUILTIN) fprintf (stderr, "gimple builtin intrinsic not matched:%d %s %s\n", fn_code, fn_name1, fn_name2); break;