From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 79075 invoked by alias); 19 Sep 2016 22:16:15 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 79055 invoked by uid 89); 19 Sep 2016 22:16:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=978, meissner, 2506r, meissnerlinuxvnetibmcom 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, 19 Sep 2016 22:16:13 +0000 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u8JMDeB0127645 for ; Mon, 19 Sep 2016 18:16:11 -0400 Received: from e35.co.us.ibm.com (e35.co.us.ibm.com [32.97.110.153]) by mx0a-001b2d01.pphosted.com with ESMTP id 25jmnyhq4p-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 19 Sep 2016 18:16:11 -0400 Received: from localhost by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 19 Sep 2016 16:16:10 -0600 Received: from d03dlp02.boulder.ibm.com (9.17.202.178) by e35.co.us.ibm.com (192.168.1.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 19 Sep 2016 16:16:08 -0600 Received: from b03cxnp08026.gho.boulder.ibm.com (b03cxnp08026.gho.boulder.ibm.com [9.17.130.18]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id 89C693E4003F; Mon, 19 Sep 2016 16:16:07 -0600 (MDT) Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u8JMG7j83670372; Mon, 19 Sep 2016 15:16:07 -0700 Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4FF0A6E03F; Mon, 19 Sep 2016 16:16:07 -0600 (MDT) Received: from ibm-tiger.the-meissners.org (unknown [9.32.77.111]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP id 27E596E038; Mon, 19 Sep 2016 16:16:07 -0600 (MDT) Received: by ibm-tiger.the-meissners.org (Postfix, from userid 500) id 7096945CA0; Mon, 19 Sep 2016 18:16:06 -0400 (EDT) Date: Mon, 19 Sep 2016 22:43:00 -0000 From: Michael Meissner To: Tamar Christina Cc: GCC Patches , "jakub@redhat.com" , "rguenther@suse.de" , "law@redhat.com" , nd Subject: Re: [PATCH] Optimise the fpclassify builtin to perform integer operations when possible Mail-Followup-To: Michael Meissner , Tamar Christina , GCC Patches , "jakub@redhat.com" , "rguenther@suse.de" , "law@redhat.com" , nd References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-12-10) X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16091922-0012-0000-0000-000010B212F7 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00005787; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000185; SDB=6.00759260; UDB=6.00360852; IPR=6.00533509; BA=6.00004736; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00012719; XFM=3.00000011; UTC=2016-09-19 22:16:10 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16091922-0013-0000-0000-0000459CF6BC Message-Id: <20160919221606.GA7906@ibm-tiger.the-meissners.org> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-09-19_13:,, 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-1609190298 X-IsSubscribed: yes X-SW-Source: 2016-09/txt/msg01243.txt.bz2 On Mon, Sep 12, 2016 at 04:19:32PM +0000, Tamar Christina wrote: > Hi All, > > This patch adds an optimized route to the fpclassify builtin > for floating point numbers which are similar to IEEE-754 in format. > > The goal is to make it faster by: > 1. Trying to determine the most common case first > (e.g. the float is a Normal number) and then the > rest. The amount of code generated at -O2 are > about the same +/- 1 instruction, but the code > is much better. > 2. Using integer operation in the optimized path. > > At a high level, the optimized path uses integer operations > to perform the following: > > if (exponent bits aren't all set or unset) > return Normal; > else if (no bits are set on the number after masking out > sign bits then) > return Zero; > else if (exponent has no bits set) > return Subnormal; > else if (mantissa has no bits set) > return Infinite; > else > return NaN; I haven't looked at fpclassify. I assume we can define a backend insn to do the right thing? One of the things we've noticed over the years with the PowerPC is that it can be rather expensive to move things from the floating point/vector unit to the integer registers and vice versa. This is particularly true if you having to do the transfer via the memory unit via stores and loads of different sizes. -- Michael Meissner, IBM IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA email: meissner@linux.vnet.ibm.com, phone: +1 (978) 899-4797