From patchwork Wed Sep 27 22:18:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Meissner X-Patchwork-Id: 819330 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-463081-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="MbO/6WG1"; 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 3y2XKL5mcQz9t6C for ; Thu, 28 Sep 2017 08:18:41 +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:date :from:to:subject:mime-version:content-type:message-id; q=dns; s= default; b=NmA290eq9su0bogUrTWst5fV2P/3wdNAowzGKB5SE/7C49vUBrJM3 sRIHTUL/CjyFI17OOdMSV1iXhT9tIGdvyjNy+tb3ZX5g0IXD8DJPceXNVgOBXuDb mBg+2vSB+mMFq6ae4V5RCUXeAI9/b7pKH/CkkyKFjMMqfYAWXefNy0= 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:subject:mime-version:content-type:message-id; s= default; bh=C66CzV1XM8SqCTEwL5JAGq8u2fQ=; b=MbO/6WG1o3yq44uHy1xC QgRrnkuEBU45DSD1BIR0FHeoiCEKKULEEsU58zzyWBZXJVx8zsk8707Q19fKVoyi QvEkPDFM9SJVewo2dG/B91nQZmvHDMcpzymIEsa8YiT0J0Ydd26wjK4WGkh4pD47 cjwHkvIJzyRAd4f1FNbiczw= Received: (qmail 43714 invoked by alias); 27 Sep 2017 22:18:32 -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 43697 invoked by uid 89); 27 Sep 2017 22:18:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=ham 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; Wed, 27 Sep 2017 22:18:30 +0000 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v8RMHG24033974 for ; Wed, 27 Sep 2017 18:18:24 -0400 Received: from e12.ny.us.ibm.com (e12.ny.us.ibm.com [129.33.205.202]) by mx0a-001b2d01.pphosted.com with ESMTP id 2d8jty5y48-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 27 Sep 2017 18:18:24 -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, 27 Sep 2017 18:18:23 -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, 27 Sep 2017 18:18:20 -0400 Received: from b01ledav001.gho.pok.ibm.com (b01ledav001.gho.pok.ibm.com [9.57.199.106]) by b01cxnp23034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v8RMIKH441812006; Wed, 27 Sep 2017 22:18:20 GMT Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 710442803D; Wed, 27 Sep 2017 18:18:13 -0400 (EDT) Received: from ibm-tiger.the-meissners.org (unknown [9.32.77.111]) by b01ledav001.gho.pok.ibm.com (Postfix) with ESMTP id 4C6812803A; Wed, 27 Sep 2017 18:18:13 -0400 (EDT) Received: by ibm-tiger.the-meissners.org (Postfix, from userid 500) id 5A3E746E81; Wed, 27 Sep 2017 18:18:19 -0400 (EDT) Date: Wed, 27 Sep 2017 18:18:19 -0400 From: Michael Meissner To: GCC Patches , Segher Boessenkool , David Edelsohn , Bill Schmidt Subject: [PATCH], Define __FP_FAST_FMAF128 on PowerPC ISA 3.0 Mail-Followup-To: Michael Meissner , GCC Patches , Segher Boessenkool , David Edelsohn , Bill Schmidt MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-12-10) X-TM-AS-GCONF: 00 x-cbid: 17092722-0048-0000-0000-000001EC3DCA X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007801; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000232; SDB=6.00923292; UDB=6.00464147; IPR=6.00703435; BA=6.00005609; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017295; XFM=3.00000015; UTC=2017-09-27 22:18:21 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17092722-0049-0000-0000-000042B2C44C Message-Id: <20170927221818.GA20589@ibm-tiger.the-meissners.org> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-09-27_08:, , 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-1709270311 X-IsSubscribed: yes The glibc team has requested we define the standard macro (__FP_FAST_FMAF128) for PowerPC code when we have the IEEE 128-bit floating point hardware instructions enabled. This patch does this in the PowerPC backend. As I look at the whole issue, at some point we should do this more in the machine independent portion of the compiler. I have some initial patches to do this in the c-family files, but at the present time, the patches are not complete, and I need to think about it more. So, I would like to check in this patch now, and if we come up with a machine independent version, we can back out this particular patch. I have done a full bootstrap and regression test, there were no regressions, and the new test case does run correctly. Can I check this into the trunk? [gcc] 2017-09-27 Michael Meissner * config/rs6000/rs6000-c.c (rs6000_target_modify_macros): Define __FP_FAST_FMAF128 on ISA 3.0. [gcc/testsuite] 2017-09-27 Michael Meissner * gcc.target/powerpc/float128-fma3.c: New test. Index: gcc/config/rs6000/rs6000-c.c =================================================================== --- gcc/config/rs6000/rs6000-c.c (revision 253236) +++ gcc/config/rs6000/rs6000-c.c (working copy) @@ -585,7 +585,10 @@ rs6000_target_modify_macros (bool define /* OPTION_MASK_FLOAT128_HARDWARE can be turned on if -mcpu=power9 is used or via the target attribute/pragma. */ if ((flags & OPTION_MASK_FLOAT128_HW) != 0) - rs6000_define_or_undefine_macro (define_p, "__FLOAT128_HARDWARE__"); + { + rs6000_define_or_undefine_macro (define_p, "__FLOAT128_HARDWARE__"); + rs6000_define_or_undefine_macro (define_p, "__FP_FAST_FMAF128"); + } /* options from the builtin masks. */ /* Note that RS6000_BTM_PAIRED is enabled only if Index: gcc/testsuite/gcc.target/powerpc/float128-fma3.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/float128-fma3.c (nonexistent) +++ gcc/testsuite/gcc.target/powerpc/float128-fma3.c (working copy) @@ -0,0 +1,33 @@ +/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-mpower9-vector -O2" } */ + +/* Make sure the appropriate FMA fast macros are defined. */ + +#ifdef __FP_FAST_FMAF +float +do_fmaf (float a, float b, float c) +{ + return __builtin_fmaf (a, b, c); +} +#endif + +#ifdef __FP_FAST_FMA +double +do_fma (double a, double b, double c) +{ + return __builtin_fma (a, b, c); +} +#endif + +#ifdef __FP_FAST_FMAF128 +_Float128 +do_fmaf128 (_Float128 a, _Float128 b, _Float128 c) +{ + return __builtin_fmaf128 (a, b, c); +} +#endif + +/* { dg-final { scan-assembler {\mfmadds\M|\mxsmadd.sp\M} } } */ +/* { dg-final { scan-assembler {\mfmadd\M|\mxsmadd.dp\M} } } */ +/* { dg-final { scan-assembler {\mxsmaddqp\M} } } */