From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id D4E4B3857808 for ; Tue, 5 Jan 2021 18:19:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D4E4B3857808 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 105IDYd5118412 for ; Tue, 5 Jan 2021 13:19:24 -0500 Received: from ppma01dal.us.ibm.com (83.d6.3fa9.ip4.static.sl-reverse.com [169.63.214.131]) by mx0b-001b2d01.pphosted.com with ESMTP id 35vw730354-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 05 Jan 2021 13:19:24 -0500 Received: from pps.filterd (ppma01dal.us.ibm.com [127.0.0.1]) by ppma01dal.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 105IBYKq016678 for ; Tue, 5 Jan 2021 18:19:23 GMT Received: from b01cxnp23032.gho.pok.ibm.com (b01cxnp23032.gho.pok.ibm.com [9.57.198.27]) by ppma01dal.us.ibm.com with ESMTP id 35tgf9ddch-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 05 Jan 2021 18:19:23 +0000 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp23032.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 105IJMdM31261100 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 5 Jan 2021 18:19:23 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E600BAC05E; Tue, 5 Jan 2021 18:19:22 +0000 (GMT) Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AD39FAC059; Tue, 5 Jan 2021 18:19:22 +0000 (GMT) Received: from [9.85.162.50] (unknown [9.85.162.50]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP; Tue, 5 Jan 2021 18:19:22 +0000 (GMT) Subject: Re: [PATCH] powerpc: Add optimized ilogbf128 for POWER9 To: Raphael Moreira Zinsly , libc-alpha@sourceware.org Cc: tuliom@linux.ibm.com References: <20201222153039.17722-1-rzinsly@linux.ibm.com> <0214e95f-54ee-79f3-23b1-3825b74e6fef@linux.ibm.com> From: Paul E Murphy Message-ID: <95d53f01-982f-4b00-b94c-e56eabbef7a5@linux.ibm.com> Date: Tue, 5 Jan 2021 12:19:22 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <0214e95f-54ee-79f3-23b1-3825b74e6fef@linux.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.343, 18.0.737 definitions=2021-01-05_05:2021-01-05, 2021-01-05 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 clxscore=1015 mlxscore=0 lowpriorityscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 phishscore=0 suspectscore=0 priorityscore=1501 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101050103 X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 18:19:26 -0000 On 1/4/21 5:20 PM, Paul E Murphy via Libc-alpha wrote: > > > On 12/22/20 9:30 AM, Raphael Moreira Zinsly via Libc-alpha wrote: >> The instruction xsxexpqp introduced on POWER9 extracts the exponent >> from a quad-precision floating-point, thus it can be used to improve >> ilogbf128 and llogbf128. >> --- >>   .../powerpc/powerpc64/le/fpu/e_ilogbf128.c    | 22 +++++++++++++++++++ >>   1 file changed, 22 insertions(+) >>   create mode 100644 sysdeps/powerpc/powerpc64/le/fpu/e_ilogbf128.c >> >> diff --git a/sysdeps/powerpc/powerpc64/le/fpu/e_ilogbf128.c >> b/sysdeps/powerpc/powerpc64/le/fpu/e_ilogbf128.c >> new file mode 100644 >> index 0000000000..47558bbadc >> --- /dev/null >> +++ b/sysdeps/powerpc/powerpc64/le/fpu/e_ilogbf128.c >> @@ -0,0 +1,22 @@ >> +#ifdef _ARCH_PWR9 >> +int _ilogbf128 (_Float128 __x); > > This should be a locally (static) scoped function. > >> + >> +int >> +#if defined(_F128_ENABLE_IFUNC) >> +__ieee754_ilogbf128_power9 (_Float128 __x) >> +#else >> +__ieee754_ilogbf128 (_Float128 __x) >> +#endif >> +{ >> +  /* Check for exceptional cases.  */ >> +  if (!__builtin_vsx_scalar_test_data_class_qp (__x, 0x7f)) >> +    return __builtin_vsx_scalar_extract_expq (__x) - 0x3fff; >> +  else >> +    /* Fallback to the generic ilogb if __x is NaN, Inf or >> subnormal.  */ >> +    return _ilogbf128(__x); >> +} >> + >> +#define __ieee754_ilogbf128 _ilogbf128 >> +#endif >> + >> +#include > > A space seems to be missing between include and <. > > Otherwise, LGTM. > > As a side note, I think the benchtests are not too impressive. I am > surprised normal values don't show better results. After spending a little time looking at this, the call overhead of the wrapper is hiding most of the improvement. Similarly, power9 adds similar instructions for float32/float64. I would recommend refactoring this patch to provide an override to w_ilogb_template.c so all three formats can use these new instructions without the call overhead for normal numbers.