From patchwork Fri Jan 31 19:17:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 860999 Delivered-To: patch@linaro.org Received: by 2002:adf:fb05:0:b0:385:e875:8a9e with SMTP id c5csp891419wrr; Fri, 31 Jan 2025 11:22:09 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXiHjwyeKyMAHjirj8WJm3Oi4TMgLq8PV+GNySNPh891I+Mrd6SS9F2gMESRk5Cdvj6MdQSvA==@linaro.org X-Google-Smtp-Source: AGHT+IFpWRw+MYof+gm4cFfi4B9rwPwMWw0kV7e7FIR+T5A5d1M9cHKip4uSrgWd7cOKV7aFCI0/ X-Received: by 2002:a05:622a:10e:b0:467:6833:e30c with SMTP id d75a77b69052e-46fd0afd50dmr185209201cf.30.1738351329651; Fri, 31 Jan 2025 11:22:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1738351329; cv=pass; d=google.com; s=arc-20240605; b=LY5JgxTstDLnexPIyexYqjdZ1ygn+Pmhl1mygq0e5pG9fa4o3JYkL8wIaVaHr7+vL0 1jFEYj5AEPb7XYYfIR/L/2ETVIokyyVvrbK4udSZXXmgyDj5z8zfA2W+QV/MNKv6esIK RM4veFP6xnw0z58X/rSkWKoN+uWtoetovNUHJwzdgQq1Oxjs8I4MKz4KPtsSbmzvyBoL gQp24Uun1ndkAJaU5rgZlfVmDfTvnvHFG6merTF98NVu7O6SzmnPLoEL0u9D3fIzG8MC h3JUol1RjVBkrQsZjuNaEfxVeMNc8m06JXceLjpCo9HFmdpyxUoavJ1sIW6hFiXw02Nt P34w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=1yTD8tPCEvjD/RTYfOv6yqV87Cs3TmhxICNvr28daTo=; fh=T3r0zdCptMfvhfOunKrfbObcLBcSXv7WNDNor/iY12Y=; b=cRm0EAXgGhzFESlxoMEgMekIqQnxonsp6K/S5uOithWiylQufumYFY1XSD/6gNNoRZ 66UxGPlrHPI7IH8GkCw73h0Y4YxdLmf/SIT2MyKRkQYWmdp/lIW2xFoPC2zkENyzDqqq x83/uz0whJSERkNhs+Xynznuytl1om/DGCYpgFaNapVRdy5pFu0vn4+2PozRtq6WEXCx WlHai2LkVq3qAg3O+vH1Hj7A1KgGcd8gfpv9UYzgTs8jTfQ6VbtFSyNK10NnPsKQJB0E m+KLxYfNQDp3KeePzEGPOfYAf7Z2nLltSYWuhifeXavz9cT44Mz47B90zw23VddnjLpu aOKg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qvBgagSR; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="libc-alpha-bounces~patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id d75a77b69052e-46fdf1e235asi42586301cf.548.2025.01.31.11.22.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jan 2025 11:22:09 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qvBgagSR; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="libc-alpha-bounces~patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4CC9F3857BBF for ; Fri, 31 Jan 2025 19:22:09 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by sourceware.org (Postfix) with ESMTPS id 6A5193858417 for ; Fri, 31 Jan 2025 19:19:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6A5193858417 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6A5193858417 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::102b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1738351190; cv=none; b=Dz62o82bo8S2eqH/RHpNypJx5XG+BYqxz1r7+K7LoTwlAnTHU0f5ky/tIId9dxJbgs4SrhJAhn+cuw6y1FNuOQEkarQSn8TQYU4pVDGJzk9iSaJKXwQqvdxKRa8x4dnWjsNC3qXSDGCWUee+j/L0EHBMhkk0f+yAqFr21L5pAKg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1738351190; c=relaxed/simple; bh=Yw8LCsNT/lGlIkohG9hFRyJB/s9h6z2mJmoVwXIgUCU=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Nb3tCMMaXqOjYqijFiZg5FxF0RP9MD1MaH0EeQ3mKayU6DYLrS0f7adrbM5y4XcmFnPQYZP8Oys20S9cEmw2C8mxu0wPGxGijHdYzC3/AFZmqbgI5lYqhEwlU95xi1Vl8BtGMTLuU4el/Zp9zdYltJnkDYetar/gnxSq7QDE6GI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pj1-x102b.google.com with SMTP id 98e67ed59e1d1-2efe25558ddso3151106a91.2 for ; Fri, 31 Jan 2025 11:19:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738351168; x=1738955968; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1yTD8tPCEvjD/RTYfOv6yqV87Cs3TmhxICNvr28daTo=; b=qvBgagSRaseCCZibVbEz5giE7YBjSx66vnyWPNAvXPapgiELXUOEuHM73pLI68sQcK QZIiUo8rKkKZXBRycxwl9rk7zBkMxZQWIfndLpf7eLz0KjP4HStChBfE9zRNBbNphMf2 Tu9yS73MQSBxVt3m89AKuqB83pVS+7UdsoNo09+LFe92qDeLDXRK7jnbChy0fIso0kb4 QLNAj/5lxYWDS8Hv39zCG4cOJSE3jPkzlgEpkDBPe2rz45jHpYz4x0EGh7J9N2dtlzc9 EMEehvvsQFIuppz0o+3CRe6OAlKtwg8QDbVvpA5cHQhb6MqGaRNM3t6PZc2QqK3RbjeN 8PVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738351168; x=1738955968; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1yTD8tPCEvjD/RTYfOv6yqV87Cs3TmhxICNvr28daTo=; b=SaGxRRaESemB8sYerjL6Six/UeN2NY67SBs9pwW01P6TIptWZu7LS3Vxl+QsnyjE8w D8KvyBYsrJouBAp8jZSUxHDLUUm+0c1OQQK0+B5jvWYpNU88P8hFX0U9Cc4r3ydHRcrU Qc2PbE8G8KJi4RMbw1ZpCUhtbsez5HeQ1IVf71zmRSknHDMIia80emfNKq8NDCh/o/+0 AJX6DQxUilpwUcqTYxxKPkKswVh6q6QX4zLO6ewWFazWOPuTbuBby1R/+VTfY2ikWms4 VMBKzovr6jXLp9aBHxkaJrigMJJH5WWI8y8X0Dk1YQtdC4psLzSQG7yak33AW49Okwye DYTg== X-Gm-Message-State: AOJu0YyGVRSli7oCl16ErquIuY5Zwc697SLdLp2goqhxst6BFpEiyWv0 55CFCrTifh4pq0RYLNkheVIzlj13ZSk9fWwE3niDO4vh/qUleusotVvGVpgC07Ra1M2ZTlVtPAv 0 X-Gm-Gg: ASbGnctR9X6/vcWrjJndga4B8nvEs/6e3vz+UVYmuJwEJalsPQG5ZJbUUnFnFlo8fLS fRfL1RDlY10y3bY9hMEme5V1Ca5affvGg/1wzAIqRLpLBCfjc0GJxVu/x1osQY1LIrIR7G9sHIY V578LKu3bRMQsAm0rbw9Gg0NIdII1iaHHKKd3X03X5eVX4n6Ro6oMFqjGys+UrHIpgrsrB5Zbu0 xd4QEfNVPF/U1XG3rtnfizEO2zjiItKD5vB3+jhndQsgrKmw/2n/9Zf70ep94mY+4gmKJqJIGml +UsWZ31d43hV/fIWQG/i53Q/xBL8MA== X-Received: by 2002:a17:90b:2d48:b0:2f8:b2c:5ef3 with SMTP id 98e67ed59e1d1-2f83abf3529mr19427847a91.14.1738351168045; Fri, 31 Jan 2025 11:19:28 -0800 (PST) Received: from ubuntu-vm.. ([177.103.113.118]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f830a3d74esm2530475a91.2.2025.01.31.11.19.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jan 2025 11:19:27 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: DJ Delorie , Joseph Myers , Paul Zimmermann , Alexei Sibidanov Subject: [PATCH 15/15] x86_64: Add asinpif with FMA Date: Fri, 31 Jan 2025 16:17:19 -0300 Message-ID: <20250131191844.2582716-16-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250131191844.2582716-1-adhemerval.zanella@linaro.org> References: <20250131191844.2582716-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patch=linaro.org@sourceware.org The CORE-MATH asinpif implementation showed slight worse performance when using x86_64 baseline ABI due its usage of fma on fast path. This patch adds a ifunc variant with similar performance for x86_64-v3. Reviewed-by: Noah Goldstein --- sysdeps/ieee754/flt-32/s_asinpif.c | 2 ++ sysdeps/x86_64/fpu/multiarch/Makefile | 2 ++ sysdeps/x86_64/fpu/multiarch/s_asinpif-fma.c | 4 +++ sysdeps/x86_64/fpu/multiarch/s_asinpif.c | 33 ++++++++++++++++++++ 4 files changed, 41 insertions(+) create mode 100644 sysdeps/x86_64/fpu/multiarch/s_asinpif-fma.c create mode 100644 sysdeps/x86_64/fpu/multiarch/s_asinpif.c diff --git a/sysdeps/ieee754/flt-32/s_asinpif.c b/sysdeps/ieee754/flt-32/s_asinpif.c index 585dc3f06e..42dbafdf97 100644 --- a/sysdeps/ieee754/flt-32/s_asinpif.c +++ b/sysdeps/ieee754/flt-32/s_asinpif.c @@ -133,4 +133,6 @@ __asinpif (float x) return r; } } +#ifndef __asinpif libm_alias_float (__asinpi, asinpi) +#endif diff --git a/sysdeps/x86_64/fpu/multiarch/Makefile b/sysdeps/x86_64/fpu/multiarch/Makefile index e823d2fcc6..e00d76eb81 100644 --- a/sysdeps/x86_64/fpu/multiarch/Makefile +++ b/sysdeps/x86_64/fpu/multiarch/Makefile @@ -13,6 +13,7 @@ CFLAGS-s_tan-fma.c = -mfma -mavx2 CFLAGS-s_sincos-fma.c = -mfma -mavx2 CFLAGS-s_exp10m1f-fma.c = -mfma -mavx2 CFLAGS-s_exp2m1f-fma.c = -mfma -mavx2 +CFLAGS-s_asinpif-fma.c = -mfma -mavx2 CFLAGS-e_exp2f-fma.c = -mfma -mavx2 CFLAGS-e_expf-fma.c = -mfma -mavx2 @@ -68,6 +69,7 @@ libm-sysdep_routines += \ e_logf-fma \ e_pow-fma \ e_powf-fma \ + s_asinpif-fma \ s_atan-avx \ s_atan-fma \ s_ceil-sse4_1 \ diff --git a/sysdeps/x86_64/fpu/multiarch/s_asinpif-fma.c b/sysdeps/x86_64/fpu/multiarch/s_asinpif-fma.c new file mode 100644 index 0000000000..3c85bec1c9 --- /dev/null +++ b/sysdeps/x86_64/fpu/multiarch/s_asinpif-fma.c @@ -0,0 +1,4 @@ +#define __asinpif __asinpif_fma +#define SECTION __attribute__ ((section (".text.fma"))) + +#include diff --git a/sysdeps/x86_64/fpu/multiarch/s_asinpif.c b/sysdeps/x86_64/fpu/multiarch/s_asinpif.c new file mode 100644 index 0000000000..98add04b7f --- /dev/null +++ b/sysdeps/x86_64/fpu/multiarch/s_asinpif.c @@ -0,0 +1,33 @@ +/* Multiple versions of asinpif. + Copyright (C) 2024-2025 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 + . */ + +#include +#if MINIMUM_X86_ISA_LEVEL < AVX2_X86_ISA_LEVEL +# include + +extern float __redirect_asinpif (float); + +# define SYMBOL_NAME asinpif +# include "ifunc-fma.h" + +libc_ifunc_redirected (__redirect_asinpif, __asinpif, IFUNC_SELECTOR ()); +libm_alias_float (__asinpi, asinpi) + +# define __asinpif __asinpif_sse2 +#endif +#include