From patchwork Tue Jun 10 13:32:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 114147 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EA35B382C0A8 for ; Tue, 10 Jun 2025 13:33:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EA35B382C0A8 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=tOrrMZO5 X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x731.google.com (mail-qk1-x731.google.com [IPv6:2607:f8b0:4864:20::731]) by sourceware.org (Postfix) with ESMTPS id 62504385783C for ; Tue, 10 Jun 2025 13:32:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 62504385783C 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 62504385783C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::731 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1749562374; cv=none; b=yERBFkd5InaygZvoKxrihs14FKcrPNbm5VmWhnrGYhdQUzYok4byFCiqv7VxeTaxI1eCNLfUQ9QEE00NSL3uLlWYhMbrnJsmxiwHUXJVmyZSj9svU6Mxv7+deVSAJBLSCUrr82B0S7PGs6Kn5dBe4Db026+DFp3RkSxi7F75CQI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1749562374; c=relaxed/simple; bh=GJXXQOPqYQet0ChY6Lpf2airDIlrB1XbwxbtEUZSxhw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=XKRwbBJ17ed1AbinxyEoSo+PM4/6dDAD1P1QTXSBwvXiMwc3h+a5fFbzFCww85+zSfnNzsaU6tyZKoDsgkEL+UM7Pp8vDQ1M9WmKTC2zoPTMUQUIyQ4GQUGcz9EikqGHbpuyxBHpV7RrzFZuNCfLFzbfNBvFArWm7cSKK5lfCJg= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 62504385783C Received: by mail-qk1-x731.google.com with SMTP id af79cd13be357-7d20451c016so290315485a.1 for ; Tue, 10 Jun 2025 06:32:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1749562373; x=1750167173; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=EJJ/zcbBRyPf+kXN9k/EmnaAoo8jGLOJ5RrGkpXw7VI=; b=tOrrMZO51dJYzyYQsjSX2fy2N8gxw/X9X2JukH6A/UqGggl+oGpEFAuL5PvIv16iVO wqZExC9EjPP/EZ3GWZU2xQ7rK3gGiKGvFwGXRRJgx+fl810imYUr4x+OMHnaqvhe1Fc/ TC294ssr0fxGGM41mE/T2TEQWFcyrlgnreuJjloQjT+Xv+qOszzVV2pAhz53JGGZbKep IJfSevJcemGrvMDKEY/vYFq8JVyrccdac1+1NKDIeccMizMwkjpfu5E7tVK17tPA7Ndt epP88cvsG2hW7eELHAGVKp8ZWHhPq8Jx0AzoDavLScETdZczsZN4kuGUnWKh/2f4A6L3 TRAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749562373; x=1750167173; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=EJJ/zcbBRyPf+kXN9k/EmnaAoo8jGLOJ5RrGkpXw7VI=; b=XjwxI8beM2v5MOThk6hwKuS/Ix+XdBxqyKZ8fyUa8hfgolluSTV9dymz2/1yOZU64Q hv5RPMZRlfunVa4uDf2UmfxpR9blBm/1oZobF6Cx6FBadps6rAiof8kOj209yo/LBrtM Q4IpRmQ+4np9VvxXlU9vTiu+1yedA8NH9Kd52juJOZyVCKZuS8s1n/4XqqhMeHjKLjkJ SLsjfSkeylRo/Gvd3NXj4T85gK7sUvR0j9K+0z6mclxNfy42SPP4q+/VQUrTf1PiSNgJ H0URKYHTgMQP8W4AsT5eZQ2ktmX0I67lJD878yx9BsXZIoGjXANtDmAScACw6k3R5bn9 orjw== X-Gm-Message-State: AOJu0YzliVHjupuBwB5j5EhxN4t6h4NVtUWy30SIyQm6v/KQcWqpJph0 Mh9foJBu2gBAl3ol8pTd4ZaOY/ZkmAOreLySkumr8J+GEfwobNAAdgIr4j1JYt8/5sHKLkeoX90 gZQfp X-Gm-Gg: ASbGncu7nki8Mc7I8UfUvU/4mE+W0oitYqe8OqD44NvfIv0pmBAYQ/EHnjV8wwkVWhp aBKlGXCB8EpfxdPQbzOJa6TZpHWawAQ4SHAw1VzM+9tMPxsTHzrS7DG9pkPwBMksaaN9jZrLXn2 bkkCvOecMUgWGjpfJ2nnmD4CTVAmlSOujNuKykpnIJKI0neJHJrxHp3lvQBaMa+VMT3RXMyNg1g rXW2/gmv3N/pgzn2Ms5C+uSuBJ2QR+WSbSUc1bVdZULGh7JbBLjFEIWoB8Xxa03wrtF8RAyarlS eP49bk6/1GNdGFG9U9yxqhV2JVjyykInEkaKO0szh6U9yO32V9ZYyx0BIETxtGFJ1ovyxMjJe7E = X-Google-Smtp-Source: AGHT+IGFudkuLComGRNGQJAlCDdCMQsop4HXOvX1CLHinoQiPOrtiyNWmomWQbHaUTpBs1w9aTYKxg== X-Received: by 2002:a05:620a:199f:b0:7d2:1458:defc with SMTP id af79cd13be357-7d22997395dmr2523255085a.33.1749562373016; Tue, 10 Jun 2025 06:32:53 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c2:8c5f:ea82:5fa3:81bb:15d6]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-87eeae649c4sm1211636241.8.2025.06.10.06.32.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jun 2025 06:32:52 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Sachin Monga Subject: [PATCH v4] powerpc: Use generic ilogb/ilogbf and refactor ilogbf128 Date: Tue, 10 Jun 2025 10:32:25 -0300 Message-ID: <20250610133248.3585250-1-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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~patchwork=sourceware.org@sourceware.org The powerpc64 leverages the use of xsxexpdp and xsxexpqp for for both ilogb/ilogbf for float, double, and float128 types. However with the new generic ilogb/ilogbf, this is not really a gain anymore. On POWER9 with gcc-13, the xsxexpdp/xsxexpqp shows: $ ./benchtests/bench-ilogb "ilogb": { "subnormal": { "duration": 5.08829e+08, "iterations": 4.4588e+07, "max": 18.761, "min": 6.7005, "mean": 11.4118 }, "normal": { "duration": 5.04674e+08, "iterations": 9.9596e+07, "max": 7.386, "min": 5.0505, "mean": 5.06722 } $ ./benchtests/bench-ilogbf "ilogbf": { "subnormal": { "duration": 5.04918e+08, "iterations": 9.8732e+07, "max": 7.1595, "min": 5.0475, "mean": 5.11402 }, "normal": { "duration": 5.04971e+08, "iterations": 9.8744e+07, "max": 7.771, "min": 5.048, "mean": 5.11394 } } While the new generic implementation shows: $ ./benchtests/bench-ilogb "ilogb": { "subnormal": { "duration": 5.05389e+08, "iterations": 9.2644e+07, "max": 11.0355, "min": 5.4255, "mean": 5.45517 }, "normal": { "duration": 5.04667e+08, "iterations": 1.02388e+08, "max": 9.758, "min": 4.8945, "mean": 4.92897 } } $ ./benchtests/bench-ilogbf "ilogbf": { "subnormal": { "duration": 5.05409e+08, "iterations": 9.238e+07, "max": 7.69, "min": 5.442, "mean": 5.47098 }, "normal": { "duration": 5.0456e+08, "iterations": 1.02012e+08, "max": 6.84, "min": 4.922, "mean": 4.94609 } } The xsxexpdp/xsxexpqp also adds some extra code size overhead since it uses the generic ilogb/ilogbf for 0/inf/NaN handling. It is still kept for float128, and this patch also optimizes it to avoid need to call extra generic symbol to handle not number inputs. On same hardware (POWER9/gcc-13) it shows the improvement: * master "ilogbf128": { "subnormal": { "duration": 5.09608e+08, "iterations": 3.3092e+07, "max": 28.845, "min": 6.824, "mean": 15.3997 }, "normal": { "duration": 5.05148e+08, "iterations": 9.1692e+07, "max": 7.744, "min": 5.377, "mean": 5.50918 } } * patch: "ilogbf128": { "subnormal": { "duration": 5.0586e+08, "iterations": 8.388e+07, "max": 7.3295, "min": 5.952, "mean": 6.03076 }, "normal": { "duration": 5.04783e+08, "iterations": 9.6608e+07, "max": 8.9255, "min": 5.185, "mean": 5.22507 } } Checked on powerpc64le-linux-gnu and powerpc64le-linux-gnu targetting POWER8 and with --disable-multi-arch on POWER9. --- Changes from v3 * Rebased against master. --- sysdeps/powerpc/powerpc64/le/fpu/e_ilogb.c | 41 ------------- sysdeps/powerpc/powerpc64/le/fpu/e_ilogbf.c | 41 ------------- .../powerpc/powerpc64/le/fpu/e_ilogbf128.c | 1 + .../powerpc/powerpc64/le/fpu/e_llogbf128.c | 1 + .../powerpc64/le/fpu/multiarch/Makefile | 2 +- sysdeps/powerpc/powerpc64/le/fpu/w_ilogb.c | 2 - .../powerpc64/le/fpu/w_ilogb_template.c | 30 ---------- sysdeps/powerpc/powerpc64/le/fpu/w_ilogbf.c | 2 - .../powerpc64/le/fpu/w_ilogbf128-impl.h | 57 +++++++++++++++++++ .../powerpc64/le/fpu/w_ilogbf128-power9.c | 1 + .../powerpc/powerpc64/le/fpu/w_ilogbf128.c | 51 +++++++++++++++++ sysdeps/powerpc/powerpc64/le/fpu/w_llogb.c | 2 - sysdeps/powerpc/powerpc64/le/fpu/w_llogbf.c | 2 - .../powerpc64/le/fpu/w_llogbf128-power9.c | 1 + .../powerpc/powerpc64/le/fpu/w_llogbf128.c | 2 + 15 files changed, 115 insertions(+), 121 deletions(-) delete mode 100644 sysdeps/powerpc/powerpc64/le/fpu/e_ilogb.c delete mode 100644 sysdeps/powerpc/powerpc64/le/fpu/e_ilogbf.c create mode 100644 sysdeps/powerpc/powerpc64/le/fpu/e_ilogbf128.c create mode 100644 sysdeps/powerpc/powerpc64/le/fpu/e_llogbf128.c delete mode 100644 sysdeps/powerpc/powerpc64/le/fpu/w_ilogb.c delete mode 100644 sysdeps/powerpc/powerpc64/le/fpu/w_ilogb_template.c delete mode 100644 sysdeps/powerpc/powerpc64/le/fpu/w_ilogbf.c create mode 100644 sysdeps/powerpc/powerpc64/le/fpu/w_ilogbf128-impl.h create mode 100644 sysdeps/powerpc/powerpc64/le/fpu/w_ilogbf128-power9.c create mode 100644 sysdeps/powerpc/powerpc64/le/fpu/w_ilogbf128.c delete mode 100644 sysdeps/powerpc/powerpc64/le/fpu/w_llogb.c delete mode 100644 sysdeps/powerpc/powerpc64/le/fpu/w_llogbf.c create mode 100644 sysdeps/powerpc/powerpc64/le/fpu/w_llogbf128-power9.c create mode 100644 sysdeps/powerpc/powerpc64/le/fpu/w_llogbf128.c diff --git a/sysdeps/powerpc/powerpc64/le/fpu/e_ilogb.c b/sysdeps/powerpc/powerpc64/le/fpu/e_ilogb.c deleted file mode 100644 index 89e7498266..0000000000 --- a/sysdeps/powerpc/powerpc64/le/fpu/e_ilogb.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Get integer exponent of a floating-point value. - Copyright (C) 1999-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 -#include -#include -#include "math_config.h" - -int -__ieee754_ilogb (double x) -{ - uint64_t ux = asuint64 (x); - int ex = (ux & ~SIGN_MASK) >> MANTISSA_WIDTH; - if (ex == 0) /* zero or subnormal */ - { - /* Clear sign and exponent */ - ux <<= 12; - if (ux == 0) - return FP_ILOGB0; - /* subnormal */ - return -1023 - stdc_leading_zeros (ux); - } - if (ex == EXPONENT_MASK >> MANTISSA_WIDTH) /* NaN or Inf */ - return ux << 12 ? FP_ILOGBNAN : INT_MAX; - return ex - 1023; -} diff --git a/sysdeps/powerpc/powerpc64/le/fpu/e_ilogbf.c b/sysdeps/powerpc/powerpc64/le/fpu/e_ilogbf.c deleted file mode 100644 index 1c2a8a5ade..0000000000 --- a/sysdeps/powerpc/powerpc64/le/fpu/e_ilogbf.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Get integer exponent of a floating-point value. - Copyright (C) 1999-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 -#include -#include -#include "sysdeps/ieee754/flt-32/math_config.h" - -int -__ieee754_ilogbf (float x) -{ - uint32_t ux = asuint (x); - int ex = (ux & ~SIGN_MASK) >> MANTISSA_WIDTH; - if (ex == 0) /* zero or subnormal */ - { - /* Clear sign and exponent. */ - ux <<= 1 + EXPONENT_WIDTH; - if (ux == 0) - return FP_ILOGB0; - /* sbunormal */ - return -127 - stdc_leading_zeros (ux); - } - if (ex == EXPONENT_MASK >> MANTISSA_WIDTH) /* NaN or Inf */ - return ux << (1 + EXPONENT_WIDTH) ? FP_ILOGBNAN : INT_MAX; - return ex - 127; -} 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..4ec3582ae4 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/le/fpu/e_ilogbf128.c @@ -0,0 +1 @@ +/* Not needed, implemented at w_ilogbf128.c */ diff --git a/sysdeps/powerpc/powerpc64/le/fpu/e_llogbf128.c b/sysdeps/powerpc/powerpc64/le/fpu/e_llogbf128.c new file mode 100644 index 0000000000..163d9e2523 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/le/fpu/e_llogbf128.c @@ -0,0 +1 @@ +/* Not needed, implemented at w_llogbf128.c */ diff --git a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/Makefile index 1a0e496d41..24c6df2264 100644 --- a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/Makefile @@ -90,7 +90,7 @@ gen-libm-f128-ifunc-routines = \ e_acosf128 e_acoshf128 e_asinf128 e_atan2f128 e_atanhf128 e_coshf128 \ e_expf128 e_fmodf128 e_hypotf128 e_j0f128 e_j1f128 e_jnf128 \ e_lgammaf128_r e_logf128 e_log10f128 e_powf128 e_remainderf128 \ - e_sinhf128 e_sqrtf128 e_gammaf128_r e_ilogbf128 k_tanf128 s_asinhf128 \ + e_sinhf128 e_sqrtf128 e_gammaf128_r k_tanf128 s_asinhf128 \ s_atanf128 s_cbrtf128 s_ceilf128 s_compoundnf128 s_cosf128 s_erff128 \ s_exp10m1f128 s_exp2m1f128 s_expm1f128 \ s_fabsf128 s_floorf128 s_log1pf128 s_logbf128 \ diff --git a/sysdeps/powerpc/powerpc64/le/fpu/w_ilogb.c b/sysdeps/powerpc/powerpc64/le/fpu/w_ilogb.c deleted file mode 100644 index 9c26217021..0000000000 --- a/sysdeps/powerpc/powerpc64/le/fpu/w_ilogb.c +++ /dev/null @@ -1,2 +0,0 @@ -#include -#include diff --git a/sysdeps/powerpc/powerpc64/le/fpu/w_ilogb_template.c b/sysdeps/powerpc/powerpc64/le/fpu/w_ilogb_template.c deleted file mode 100644 index b5c1c0aa9d..0000000000 --- a/sysdeps/powerpc/powerpc64/le/fpu/w_ilogb_template.c +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include -#include -#include -#include - -#if _GL_HAS_BUILTIN_ILOGB -int -M_DECL_FUNC (__ilogb) (FLOAT x) -{ - int r; - /* Check for exceptional cases. */ - if (! M_SUF(__builtin_test_dc_ilogb) (x, 0x7f)) - r = M_SUF (__builtin_ilogb) (x); - else - /* Fallback to the generic ilogb if x is NaN, Inf or subnormal. */ - r = M_SUF (__ieee754_ilogb) (x); - if (__builtin_expect (r == FP_ILOGB0, 0) - || __builtin_expect (r == FP_ILOGBNAN, 0) - || __builtin_expect (r == INT_MAX, 0)) - { - __set_errno (EDOM); - __feraiseexcept (FE_INVALID); - } - return r; -} -declare_mgen_alias (__ilogb, ilogb) -#else -#include -#endif diff --git a/sysdeps/powerpc/powerpc64/le/fpu/w_ilogbf.c b/sysdeps/powerpc/powerpc64/le/fpu/w_ilogbf.c deleted file mode 100644 index 047ad4bf11..0000000000 --- a/sysdeps/powerpc/powerpc64/le/fpu/w_ilogbf.c +++ /dev/null @@ -1,2 +0,0 @@ -#include -#include diff --git a/sysdeps/powerpc/powerpc64/le/fpu/w_ilogbf128-impl.h b/sysdeps/powerpc/powerpc64/le/fpu/w_ilogbf128-impl.h new file mode 100644 index 0000000000..10c328f602 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/le/fpu/w_ilogbf128-impl.h @@ -0,0 +1,57 @@ +/* Get integer exponent of a floating-point value. + Copyright (C) 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 + . */ + +/* Use the double version of EDOM/invalid operation handling. */ +#include "math_config.h" + +static RET_TYPE +llogb_nan_inf_subnormal (uint64_t hx, uint64_t lx) +{ + if (hx <= 0x0001000000000000ULL) + { + /* Zero or subnormal. */ + if ((hx | lx) == 0) + return RET_INVALID (RET_LOGB0); + /* Subnormal */ + if (hx == 0) + return (RET_TYPE)-16431 - stdc_leading_zeros (lx); + else + return (RET_TYPE)-16382 - stdc_leading_zeros (hx << 15); + } + return RET_INVALID (RET_LOGBNAN); +} + +static inline RET_TYPE +IMPL_NAME (FLOAT x) +{ + uint64_t hx, lx; + GET_FLOAT128_WORDS64 (hx, lx, x); + hx &= 0x7fffffffffffffffULL; + +#if _GL_HAS_BUILTIN_ILOGB + /* Check for exceptional cases. */ + if (__glibc_likely (! M_SUF(__builtin_test_dc_ilogb) (x, 0x7f))) + return M_SUF (__builtin_ilogb) (x); +#else + if (__glibc_likely (hx < 0x7fff000000000000ULL + && hx > 0x0001000000000000ULL)) + return (hx >> 48) - 0x3fff; +#endif + + return llogb_nan_inf_subnormal (hx, lx); +} diff --git a/sysdeps/powerpc/powerpc64/le/fpu/w_ilogbf128-power9.c b/sysdeps/powerpc/powerpc64/le/fpu/w_ilogbf128-power9.c new file mode 100644 index 0000000000..9de3f2101e --- /dev/null +++ b/sysdeps/powerpc/powerpc64/le/fpu/w_ilogbf128-power9.c @@ -0,0 +1 @@ +#include "w_ilogbf128.c" diff --git a/sysdeps/powerpc/powerpc64/le/fpu/w_ilogbf128.c b/sysdeps/powerpc/powerpc64/le/fpu/w_ilogbf128.c new file mode 100644 index 0000000000..ae3e4a9e48 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/le/fpu/w_ilogbf128.c @@ -0,0 +1,51 @@ +/* Get integer exponent of a floating-point value. + Copyright (C) 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 +#include +#include +#include + +#ifdef DEF_AS_LLOGBF128 +# define DECL_NAME __llogb +# define FUNC_NAME llogb +# define RET_TYPE long int +# define RET_LOGB0 FP_LLOGB0 +# define RET_LOGBNAN FP_LLOGBNAN +# define RET_LOGMAX LONG_MAX +# define RET_INVALID __math_invalid_li +#else +# define DECL_NAME __ilogb +# define FUNC_NAME ilogb +# define RET_TYPE int +# define RET_LOGB0 FP_ILOGB0 +# define RET_LOGBNAN FP_ILOGBNAN +# define RET_LOGMAX INT_MAX +# define RET_INVALID __math_invalid_i +#endif +#define __IMPL_NAME(x,y) x ## _ ## y +#define _IMPL_NAME(x,y) __IMPL_NAME(x,y) +#define IMPL_NAME _IMPL_NAME(FUNC_NAME, impl) +#include + +RET_TYPE +M_DECL_FUNC (DECL_NAME) (FLOAT x) +{ + return IMPL_NAME (x); +} +declare_mgen_alias (DECL_NAME, FUNC_NAME) diff --git a/sysdeps/powerpc/powerpc64/le/fpu/w_llogb.c b/sysdeps/powerpc/powerpc64/le/fpu/w_llogb.c deleted file mode 100644 index 5e8891a668..0000000000 --- a/sysdeps/powerpc/powerpc64/le/fpu/w_llogb.c +++ /dev/null @@ -1,2 +0,0 @@ -#include -#include diff --git a/sysdeps/powerpc/powerpc64/le/fpu/w_llogbf.c b/sysdeps/powerpc/powerpc64/le/fpu/w_llogbf.c deleted file mode 100644 index edb7e9a9e6..0000000000 --- a/sysdeps/powerpc/powerpc64/le/fpu/w_llogbf.c +++ /dev/null @@ -1,2 +0,0 @@ -#include -#include diff --git a/sysdeps/powerpc/powerpc64/le/fpu/w_llogbf128-power9.c b/sysdeps/powerpc/powerpc64/le/fpu/w_llogbf128-power9.c new file mode 100644 index 0000000000..9550611b95 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/le/fpu/w_llogbf128-power9.c @@ -0,0 +1 @@ +#include "w_llogbf128.c" diff --git a/sysdeps/powerpc/powerpc64/le/fpu/w_llogbf128.c b/sysdeps/powerpc/powerpc64/le/fpu/w_llogbf128.c new file mode 100644 index 0000000000..0a67251faa --- /dev/null +++ b/sysdeps/powerpc/powerpc64/le/fpu/w_llogbf128.c @@ -0,0 +1,2 @@ +#define DEF_AS_LLOGBF128 +#include "w_ilogbf128.c"