From patchwork Thu May 17 04:55:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajalakshmi Srinivasaraghavan X-Patchwork-Id: 915070 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=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-92593-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="i/o73yUl"; 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 40mfBV3zY6z9s1d for ; Thu, 17 May 2018 14:55:30 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id; q=dns; s= default; b=BlV3TcEX4oWXpbayWNhuWV4vU6g3T6Tv1XkR9U7Xemo5JhhtqBxfq +OT5y7ggabTQ8xElzueQYRs5MgKvShHafAYeqEipyu8W8KoOqCFvdI3YTXXxJJzr vExCgMPYnq86mT55D/hw6Mio6R/KvkiwisgJy35LkWkuD3+SLP5aL4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id; s=default; bh=imzN+n9/8xNxmkX+DSOGPDmqSj4=; b=i/o73yUlmN5mR4tFOHq+rkrvmbyh hl/BslfOgfQ5wn96W24T/nqYYfgAC8GzxNb5zQcUaBJBkZF4qSiUobZ3R/tb0Tx1 Ml+u/Q89qVbV3RrXOQiQdL1zhanKkBQv0dOSoIiQ2H6H8WGuVa5JJ5L1TJO10iFs PAo7GozS1qkzcf0= Received: (qmail 11139 invoked by alias); 17 May 2018 04:55:24 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 11130 invoked by uid 89); 17 May 2018 04:55:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, KAM_SHORT, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy= X-HELO: mx0a-001b2d01.pphosted.com From: Rajalakshmi Srinivasaraghavan To: libc-alpha@sourceware.org Cc: Rajalakshmi Srinivasaraghavan Subject: [PATCH] powerpc: Add multiarch sqrtf128 for ppc64le Date: Thu, 17 May 2018 10:25:12 +0530 X-TM-AS-GCONF: 00 x-cbid: 18051704-0020-0000-0000-0000041E0F90 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18051704-0021-0000-0000-000042B32FE0 Message-Id: <1526532912-1716-1-git-send-email-raji@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-05-17_02:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=4 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805170046 This patch creates ifunc for sqrtf128() to make use of new xssqrtqp instruction for POWER9 when --enable-multi-arch and --with-cpu=power8 options are used on power9 system. This is achieved by explicitly adding -mcpu=power9 flag for sqrtf128-power9. 2018-05-17 Rajalakshmi Srinivasaraghavan * sysdeps/powerpc/powerpc64/le/fpu/multiarch/Makefile: New file to add w_sqrtf128-power9 and w_sqrtf128-ppc64le to libm-sysdep_routines. * sysdeps/powerpc/powerpc64/le/fpu/multiarch/w_sqrtf128-power9.c: New file. * sysdeps/powerpc/powerpc64/le/fpu/multiarch/w_sqrtf128-ppc64le.c: Likewise. * sysdeps/powerpc/powerpc64/le/fpu/multiarch/w_sqrtf128.c: Likewise. * sysdeps/powerpc/powerpc64/le/power9/fpu/e_sqrtf128.c: Remove file as __ieee754_sqrtf128() for power9 is present already in sysdeps/powerpc/fpu/math_private.h. --- .../powerpc/powerpc64/le/fpu/multiarch/Makefile | 6 ++++ .../multiarch/w_sqrtf128-power9.c} | 21 ++++++------ .../le/fpu/multiarch/w_sqrtf128-ppc64le.c | 37 ++++++++++++++++++++++ .../powerpc64/le/fpu/multiarch/w_sqrtf128.c | 31 ++++++++++++++++++ 4 files changed, 85 insertions(+), 10 deletions(-) create mode 100644 sysdeps/powerpc/powerpc64/le/fpu/multiarch/Makefile rename sysdeps/powerpc/powerpc64/le/{power9/fpu/e_sqrtf128.c => fpu/multiarch/w_sqrtf128-power9.c} (81%) create mode 100644 sysdeps/powerpc/powerpc64/le/fpu/multiarch/w_sqrtf128-ppc64le.c create mode 100644 sysdeps/powerpc/powerpc64/le/fpu/multiarch/w_sqrtf128.c diff --git a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/Makefile new file mode 100644 index 0000000000..a32f3d8b81 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/Makefile @@ -0,0 +1,6 @@ +ifeq ($(subdir),math) +libm-sysdep_routines += w_sqrtf128-power9 w_sqrtf128-ppc64le + +CFLAGS-w_sqrtf128-ppc64le.c += -mfloat128 +CFLAGS-w_sqrtf128-power9.c += -mfloat128 -mcpu=power9 +endif diff --git a/sysdeps/powerpc/powerpc64/le/power9/fpu/e_sqrtf128.c b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/w_sqrtf128-power9.c similarity index 81% rename from sysdeps/powerpc/powerpc64/le/power9/fpu/e_sqrtf128.c rename to sysdeps/powerpc/powerpc64/le/fpu/multiarch/w_sqrtf128-power9.c index 76ab451dbb..0629060754 100644 --- a/sysdeps/powerpc/powerpc64/le/power9/fpu/e_sqrtf128.c +++ b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/w_sqrtf128-power9.c @@ -1,6 +1,5 @@ /* POWER9 sqrt for _Float128 - Return sqrt(a) - Copyright (C) 2017-2018 Free Software Foundation, Inc. + Copyright (C) 2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -26,11 +25,13 @@ License along with the GNU C Library; if not, see . */ -__float128 -__ieee754_sqrtf128 (__float128 a) -{ - __float128 z; - asm ("xssqrtqp %0,%1" : "=v" (z) : "v" (a)); - return z; -} -strong_alias (__ieee754_sqrtf128, __sqrtf128_finite) +#include + +#define __sqrtf128 __sqrtf128_power9 + +#undef __USE_WRAPPER_TEMPLATE +#define __USE_WRAPPER_TEMPLATE 1 +#undef declare_mgen_alias +#define declare_mgen_alias(a, b) + +#include diff --git a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/w_sqrtf128-ppc64le.c b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/w_sqrtf128-ppc64le.c new file mode 100644 index 0000000000..313ef8ba9a --- /dev/null +++ b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/w_sqrtf128-ppc64le.c @@ -0,0 +1,37 @@ +/* PPC64LE sqrt for _Float128 + Copyright (C) 2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file into + combinations with other programs, and to distribute those + combinations without any restriction coming from the use of this + file. (The Lesser General Public License restrictions do apply in + other respects; for example, they cover modification of the file, + and distribution when not linked into a combine executable.) + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +#define __sqrtf128 __sqrtf128_ppc64le + +#undef __USE_WRAPPER_TEMPLATE +#define __USE_WRAPPER_TEMPLATE 1 +#undef declare_mgen_alias +#define declare_mgen_alias(a, b) + +#include diff --git a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/w_sqrtf128.c b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/w_sqrtf128.c new file mode 100644 index 0000000000..a44bf4f5cc --- /dev/null +++ b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/w_sqrtf128.c @@ -0,0 +1,31 @@ +/* Multiple versions of __sqrtf128. + Copyright (C) 2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#define NO_MATH_REDIRECT +#include +#include "init-arch.h" +#include + +extern __typeof (__sqrtf128) __sqrtf128_ppc64le attribute_hidden; +extern __typeof (__sqrtf128) __sqrtf128_power9 attribute_hidden; + +libc_ifunc (__sqrtf128, + (hwcap2 & PPC_FEATURE2_ARCH_3_00) + ? __sqrtf128_power9 + : __sqrtf128_ppc64le); +declare_mgen_alias (__sqrt, sqrt)