From patchwork Fri Oct 18 09:48:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?546L5Y2a5Z6a?= X-Patchwork-Id: 1999017 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bytedance.com header.i=@bytedance.com header.a=rsa-sha256 header.s=google header.b=FiEDlnSp; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XVKfg73FPz1xw2 for ; Fri, 18 Oct 2024 20:49:15 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2C49D3858404 for ; Fri, 18 Oct 2024 09:49:14 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x72a.google.com (mail-qk1-x72a.google.com [IPv6:2607:f8b0:4864:20::72a]) by sourceware.org (Postfix) with ESMTPS id 89D113858D20 for ; Fri, 18 Oct 2024 09:48:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 89D113858D20 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=bytedance.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 89D113858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::72a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1729244938; cv=none; b=AuRg/ng8GtZuPATaqxNGQ1HozjWfkIa+z4CtY2vZ2dMqmTUY7RKEBpelu1byDtTcIbvOr/+/wwpgR/Ox3klf5RTo3/JbEHPOD9a4x4yYUx4FIPeYEPG30C7VZCJUPvHyscFbCHgP0JGw7v0dM5T0U2J2JWwNfZPVJWyxQeF+LUs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1729244938; c=relaxed/simple; bh=IIypQRiEnIzFM5N2e2EtCZ50br14w9t5mbgFEKonv3A=; h=DKIM-Signature:Mime-Version:From:Date:Message-ID:Subject:To; b=jV3BW4tul+oopRPmdzwr1i0HkhXClJt0c3hlfW4ZwzFTJ7pRD66fwduf2dUXyhRwY2bUK6Qci1kWs7lYhWz5gmhIZLMq8GLiv9MKiQ85ENNIwmScH7rOWH4bwccBtT9JqpN3odxSkzy7dVso7zPvuotZQJtGrwy+MWEABI52ATI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-qk1-x72a.google.com with SMTP id af79cd13be357-7b1363c7977so187499585a.1 for ; Fri, 18 Oct 2024 02:48:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1729244934; x=1729849734; darn=sourceware.org; h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=datwCCEmfLZ7gym0zsCGTQUNaGResanU8fSrzSKtHt0=; b=FiEDlnSp2JfvL0S+Kim+bkBqswOUeu6wzcf19WpqxmPYHTraGbx1fle63G0Z5NqY0O ecCS5a/V5+oYdMRm2SDaE/b4JjObPIjS3WjM2Pdc1NMU84K8+oYpyAUZgDYi+uFXvxrE hprY58bReuUuc6Cf9v4jzDmn2pNxz2e5PtRDnqu4X2jwLdF8Eg3iMBIEspEteEiSCLDX B89LJDguB7UVN9qeq7GqUn0xw/mpGnKNAbtJ8BLg9a4tzGxbaxS+jnsWZyuQFmLMQMX2 MKg4pj4Jbr99fep/x4S+gKlOW7Cwsu48v4502QDEFIbQ8ShBWnogRiCajggIxtizn800 i0vQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729244934; x=1729849734; h=cc:to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=datwCCEmfLZ7gym0zsCGTQUNaGResanU8fSrzSKtHt0=; b=qjQfEnindEKhE8L1sG/g/K9/5oa/ezh8wynpZqA5j056dFdYjhfhUy76IpbvnEGiGz oLql3mJ2UDRwvcQvq63ezYmPbVyATiuY7uOCugd4svloqqP2hFR6efX+hfiJ/YwCPtex TG4C1r6XdlsWjNLbHujHSUTw13mz2dBA3AROjuOAhRHeuyPmonQ8u8VN7JoJ638YM+vK v4g6ktUWk0si98qyrvYr2VWhGoe67U+bWqoWA5lec+KOBPPR6VYX2JI7fT4AnrdvL7hb jZiQMjhJxV7W/R/uKfepy21L4Em+YNn1kp/DKHXiNp6KzBkzcK2HXT2t92DIJ+dyci9q W4hg== X-Gm-Message-State: AOJu0YxN4XmAK4WRsqc+d3tF0lCR4+qZNzkil0Rc9y93dKz2PBlasiJI DJPSQvlR/zDBSe/rMxTFPJhwTW8fvw/gtV8LsB0efRYFq8FIXj/zLedS4+F2htdlankVzL3r18A t1AlT/DbjCm2poxfIttMTyj06zeB2qJEHaYbG1dCuvGwc8soq X-Google-Smtp-Source: AGHT+IHaZk/NLI1AZ8UhFcXJVkJFl0MDFDWFJatdNkJyfBJqJDaPI5if6JigfJcjrdX+LSPDylzyMpQRTDNDaZXW7ZA= X-Received: by 2002:a05:620a:4055:b0:79d:79cb:2a5f with SMTP id af79cd13be357-7b157c12005mr209399785a.63.1729244933614; Fri, 18 Oct 2024 02:48:53 -0700 (PDT) Received: from 44278815321 named unknown by gmailapi.google.com with HTTPREST; Fri, 18 Oct 2024 05:48:53 -0400 Mime-Version: 1.0 X-Mailer: git-send-email 2.39.2 X-Original-From: wangboyao@bytedance.com From: =?utf-8?b?546L5Y2a5Z6a?= Date: Fri, 18 Oct 2024 05:48:53 -0400 Message-ID: Subject: [PATCH] RISCV:Add builtin for some riscv version function To: libc-alpha@sourceware.org Cc: wangboyao X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, HTML_MESSAGE, 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~incoming=patchwork.ozlabs.org@sourceware.org From: wangboyao Some functions in glibc, particularly those in the math library, can be more efficient when using the compiler’s built-in functions, especially in cases where certain extensions (Zfa) are supported. Signed-off-by: wangboyao --- sysdeps/riscv/math-use-builtins-ceil.h | 4 ++++ sysdeps/riscv/math-use-builtins-ffs.h | 2 ++ sysdeps/riscv/math-use-builtins-floor.h | 4 ++++ sysdeps/riscv/math-use-builtins-nearbyint.h | 4 ++++ sysdeps/riscv/math-use-builtins-rint.h | 4 ++++ sysdeps/riscv/math-use-builtins-round.h | 4 ++++ sysdeps/riscv/math-use-builtins-roundeven.h | 4 ++++ sysdeps/riscv/math-use-builtins-trunc.h | 4 ++++ sysdeps/riscv/rv64/rvd/s_ceil.c | 5 +++++ sysdeps/riscv/rv64/rvd/s_floor.c | 5 +++++ sysdeps/riscv/rv64/rvd/s_nearbyint.c | 5 +++++ sysdeps/riscv/rv64/rvd/s_rint.c | 5 +++++ sysdeps/riscv/rv64/rvd/s_round.c | 5 +++++ sysdeps/riscv/rv64/rvd/s_roundeven.c | 5 +++++ sysdeps/riscv/rv64/rvd/s_trunc.c | 5 +++++ sysdeps/riscv/rvf/s_ceilf.c | 5 +++++ sysdeps/riscv/rvf/s_floorf.c | 5 +++++ sysdeps/riscv/rvf/s_nearbyintf.c | 5 +++++ sysdeps/riscv/rvf/s_rintf.c | 5 +++++ sysdeps/riscv/rvf/s_roundevenf.c | 5 +++++ sysdeps/riscv/rvf/s_roundf.c | 5 +++++ sysdeps/riscv/rvf/s_truncf.c | 5 +++++ 22 files changed, 100 insertions(+) create mode 100644 sysdeps/riscv/math-use-builtins-ceil.h create mode 100644 sysdeps/riscv/math-use-builtins-ffs.h create mode 100644 sysdeps/riscv/math-use-builtins-floor.h create mode 100644 sysdeps/riscv/math-use-builtins-nearbyint.h create mode 100644 sysdeps/riscv/math-use-builtins-rint.h create mode 100644 sysdeps/riscv/math-use-builtins-round.h create mode 100644 sysdeps/riscv/math-use-builtins-roundeven.h create mode 100644 sysdeps/riscv/math-use-builtins-trunc.h diff --git a/sysdeps/riscv/math-use-builtins-ceil.h b/sysdeps/riscv/math-use-builtins-ceil.h new file mode 100644 index 0000000000..17d6452e51 --- /dev/null +++ b/sysdeps/riscv/math-use-builtins-ceil.h @@ -0,0 +1,4 @@ +#define USE_CEIL_BUILTIN 1 +#define USE_CEILF_BUILTIN 1 +#define USE_CEILL_BUILTIN 0 +#define USE_CEILF128_BUILTIN 0 diff --git a/sysdeps/riscv/math-use-builtins-ffs.h b/sysdeps/riscv/math-use-builtins-ffs.h new file mode 100644 index 0000000000..a83bb15414 --- /dev/null +++ b/sysdeps/riscv/math-use-builtins-ffs.h @@ -0,0 +1,2 @@ +#define USE_FFS_BUILTIN 1 +#define USE_FFSLL_BUILTIN 1 diff --git a/sysdeps/riscv/math-use-builtins-floor.h b/sysdeps/riscv/math-use-builtins-floor.h new file mode 100644 index 0000000000..553c0674af --- /dev/null +++ b/sysdeps/riscv/math-use-builtins-floor.h @@ -0,0 +1,4 @@ +#define USE_FLOOR_BUILTIN 1 +#define USE_FLOORF_BUILTIN 1 +#define USE_FLOORL_BUILTIN 0 +#define USE_FLOORF128_BUILTIN 0 diff --git a/sysdeps/riscv/math-use-builtins-nearbyint.h b/sysdeps/riscv/math-use-builtins-nearbyint.h new file mode 100644 index 0000000000..a2590c920f --- /dev/null +++ b/sysdeps/riscv/math-use-builtins-nearbyint.h @@ -0,0 +1,4 @@ +#define USE_NEARBYINT_BUILTIN 1 +#define USE_NEARBYINTF_BUILTIN 1 +#define USE_NEARBYINTL_BUILTIN 0 +#define USE_NEARBYINTF128_BUILTIN 0 diff --git a/sysdeps/riscv/math-use-builtins-rint.h b/sysdeps/riscv/math-use-builtins-rint.h new file mode 100644 index 0000000000..45c3307692 --- /dev/null +++ b/sysdeps/riscv/math-use-builtins-rint.h @@ -0,0 +1,4 @@ +#define USE_RINT_BUILTIN 1 +#define USE_RINTF_BUILTIN 1 +#define USE_RINTL_BUILTIN 0 +#define USE_RINTF128_BUILTIN 0 diff --git a/sysdeps/riscv/math-use-builtins-round.h b/sysdeps/riscv/math-use-builtins-round.h new file mode 100644 index 0000000000..f6083d7d0a --- /dev/null +++ b/sysdeps/riscv/math-use-builtins-round.h @@ -0,0 +1,4 @@ +#define USE_ROUND_BUILTIN 1 +#define USE_ROUNDF_BUILTIN 1 +#define USE_ROUNDL_BUILTIN 0 +#define USE_ROUNDF128_BUILTIN 0 diff --git a/sysdeps/riscv/math-use-builtins-roundeven.h b/sysdeps/riscv/math-use-builtins-roundeven.h new file mode 100644 index 0000000000..b7f51730d6 --- /dev/null +++ b/sysdeps/riscv/math-use-builtins-roundeven.h @@ -0,0 +1,4 @@ +#define USE_ROUNDEVEN_BUILTIN 1 +#define USE_ROUNDEVENF_BUILTIN 1 +#define USE_ROUNDEVENL_BUILTIN 0 +#define USE_ROUNDEVENF128_BUILTIN 0 diff --git a/sysdeps/riscv/math-use-builtins-trunc.h b/sysdeps/riscv/math-use-builtins-trunc.h new file mode 100644 index 0000000000..4fc6da42b6 --- /dev/null +++ b/sysdeps/riscv/math-use-builtins-trunc.h @@ -0,0 +1,4 @@ +#define USE_TRUNC_BUILTIN 1 +#define USE_TRUNCF_BUILTIN 1 +#define USE_TRUNCL_BUILTIN 0 +#define USE_TRUNCF128_BUILTIN 0 diff --git a/sysdeps/riscv/rv64/rvd/s_ceil.c b/sysdeps/riscv/rv64/rvd/s_ceil.c index dfa853f7fc..8651739959 100644 --- a/sysdeps/riscv/rv64/rvd/s_ceil.c +++ b/sysdeps/riscv/rv64/rvd/s_ceil.c @@ -21,10 +21,14 @@ #include #include #include +#include double __ceil (double x) { +#if USE_CEIL_BUILTIN + return __builtin_ceil (x); +#else int flags = riscv_getflags (); bool nan = isnan (x); double mag = fabs (x); @@ -48,6 +52,7 @@ __ceil (double x) } return x; +#endif /* ! USE_CEIL_BUILTIN */ } libm_alias_double (__ceil, ceil) diff --git a/sysdeps/riscv/rv64/rvd/s_floor.c b/sysdeps/riscv/rv64/rvd/s_floor.c index f294651147..957d4792ff 100644 --- a/sysdeps/riscv/rv64/rvd/s_floor.c +++ b/sysdeps/riscv/rv64/rvd/s_floor.c @@ -21,10 +21,14 @@ #include #include #include +#include double __floor (double x) { +#if USE_FLOOR_BUILTIN + return __builtin_floor (x); +#else int flags = riscv_getflags (); bool nan = isnan (x); double mag = fabs (x); @@ -48,6 +52,7 @@ __floor (double x) } return x; +#endif /* ! USE_FLOOR_BUILTIN */ } libm_alias_double (__floor, floor) diff --git a/sysdeps/riscv/rv64/rvd/s_nearbyint.c b/sysdeps/riscv/rv64/rvd/s_nearbyint.c index ddc512d460..b55d3d0f2f 100644 --- a/sysdeps/riscv/rv64/rvd/s_nearbyint.c +++ b/sysdeps/riscv/rv64/rvd/s_nearbyint.c @@ -20,10 +20,14 @@ #include #include #include +#include double __nearbyint (double x) { +#if USE_NEARBYINT_BUILTIN + return __builtin_nearbyint (x); +#else int flags = riscv_getflags (); bool nan = isnan (x); double mag = fabs (x); @@ -47,6 +51,7 @@ __nearbyint (double x) } return x; +#endif /* ! USE_NEARBYINT_BUILTIN */ } libm_alias_double (__nearbyint, nearbyint) diff --git a/sysdeps/riscv/rv64/rvd/s_rint.c b/sysdeps/riscv/rv64/rvd/s_rint.c index 45bea32671..7c4d23f32c 100644 --- a/sysdeps/riscv/rv64/rvd/s_rint.c +++ b/sysdeps/riscv/rv64/rvd/s_rint.c @@ -21,10 +21,14 @@ #include #include #include +#include double __rint (double x) { +#if USE_RINT_BUILTIN + return __builtin_rint (x); +#else bool nan; double mag; @@ -48,6 +52,7 @@ __rint (double x) } return x; +#endif /* ! USE_RINT_BUILTIN */ } libm_alias_double (__rint, rint) diff --git a/sysdeps/riscv/rv64/rvd/s_round.c b/sysdeps/riscv/rv64/rvd/s_round.c index bd01fcc8c9..0964f94de6 100644 --- a/sysdeps/riscv/rv64/rvd/s_round.c +++ b/sysdeps/riscv/rv64/rvd/s_round.c @@ -21,10 +21,14 @@ #include #include #include +#include double __round (double x) { +#if USE_ROUND_BUILTIN + return __builtin_round (x); +#else int flags = riscv_getflags (); bool nan = isnan (x); double mag = fabs (x); @@ -48,6 +52,7 @@ __round (double x) } return x; +#endif /* ! USE_ROUND_BUILTIN */ } libm_alias_double (__round, round) diff --git a/sysdeps/riscv/rv64/rvd/s_roundeven.c b/sysdeps/riscv/rv64/rvd/s_roundeven.c index 108c7dc970..ea888d7555 100644 --- a/sysdeps/riscv/rv64/rvd/s_roundeven.c +++ b/sysdeps/riscv/rv64/rvd/s_roundeven.c @@ -21,10 +21,14 @@ #include #include #include +#include double __roundeven (double x) { +#if USE_ROUNDEVEN_BUILTIN + return __builtin_roundeven (x); +#else int flags = riscv_getflags (); bool nan = isnan (x); double mag = fabs (x); @@ -48,6 +52,7 @@ __roundeven (double x) } return x; +#endif /* ! USE_ROUNDEVEN_BUILTIN */ } libm_alias_double (__roundeven, roundeven) diff --git a/sysdeps/riscv/rv64/rvd/s_trunc.c b/sysdeps/riscv/rv64/rvd/s_trunc.c index 779c7d26b3..82c6196ef0 100644 --- a/sysdeps/riscv/rv64/rvd/s_trunc.c +++ b/sysdeps/riscv/rv64/rvd/s_trunc.c @@ -21,10 +21,14 @@ #include #include #include +#include double __trunc (double x) { + #if USE_TRUNC_BUILTIN + return __builtin_trunc (x); + #else int flags = riscv_getflags (); bool nan = isnan (x); double mag = fabs (x); @@ -48,6 +52,7 @@ __trunc (double x) } return x; + #endif /* ! USE_TRUNC_BUILTIN */ } libm_alias_double (__trunc, trunc) diff --git a/sysdeps/riscv/rvf/s_ceilf.c b/sysdeps/riscv/rvf/s_ceilf.c index d19f17e16b..ab49a8dfbd 100644 --- a/sysdeps/riscv/rvf/s_ceilf.c +++ b/sysdeps/riscv/rvf/s_ceilf.c @@ -21,10 +21,14 @@ #include #include #include +#include float __ceilf (float x) { +#if USE_CEILF_BUILTIN + return __builtin_ceilf (x); +#else int flags = riscv_getflags (); bool nan = isnan (x); float mag = fabsf (x); @@ -48,6 +52,7 @@ __ceilf (float x) } return x; +#endif /* ! USE_CEILF_BUILTIN */ } libm_alias_float (__ceil, ceil) diff --git a/sysdeps/riscv/rvf/s_floorf.c b/sysdeps/riscv/rvf/s_floorf.c index efe104c7e0..daf708fe56 100644 --- a/sysdeps/riscv/rvf/s_floorf.c +++ b/sysdeps/riscv/rvf/s_floorf.c @@ -21,10 +21,14 @@ #include #include #include +#include float __floorf (float x) { +#if USE_FLOORF_BUILTIN + return __builtin_floorf (x); +#else int flags = riscv_getflags (); bool nan = isnan (x); float mag = fabsf (x); @@ -48,6 +52,7 @@ __floorf (float x) } return x; +#endif /* ! USE_FLOORF_BUILTIN */ } libm_alias_float (__floor, floor) diff --git a/sysdeps/riscv/rvf/s_nearbyintf.c b/sysdeps/riscv/rvf/s_nearbyintf.c index 4abaaa2551..487ca659da 100644 --- a/sysdeps/riscv/rvf/s_nearbyintf.c +++ b/sysdeps/riscv/rvf/s_nearbyintf.c @@ -20,10 +20,14 @@ #include #include #include +#include float __nearbyintf (float x) { +#if USE_NEARBYINTF_BUILTIN + return __builtin_nearbyintf (x); +#else int flags = riscv_getflags (); bool nan = isnan (x); float mag = fabsf (x); @@ -47,6 +51,7 @@ __nearbyintf (float x) } return x; +#endif /* ! USE_NEARBYINT_BUILTIN */ } libm_alias_float (__nearbyint, nearbyint) diff --git a/sysdeps/riscv/rvf/s_rintf.c b/sysdeps/riscv/rvf/s_rintf.c index f70d1b3db3..a82629a015 100644 --- a/sysdeps/riscv/rvf/s_rintf.c +++ b/sysdeps/riscv/rvf/s_rintf.c @@ -21,10 +21,14 @@ #include #include #include +#include float __rintf (float x) { +#if USE_RINTF_BUILTIN + return __builtin_rintf (x); +#else bool nan; float mag; @@ -48,6 +52,7 @@ __rintf (float x) } return x; +#endif /* ! USE_RINTF_BUILTIN */ } libm_alias_float (__rint, rint) diff --git a/sysdeps/riscv/rvf/s_roundevenf.c b/sysdeps/riscv/rvf/s_roundevenf.c index 99018c050e..813d11f92d 100644 --- a/sysdeps/riscv/rvf/s_roundevenf.c +++ b/sysdeps/riscv/rvf/s_roundevenf.c @@ -21,10 +21,14 @@ #include #include #include +#include float __roundevenf (float x) { +#if USE_ROUNDEVENF_BUILTIN + return __builtin_roundevenf (x); +#else int flags = riscv_getflags (); bool nan = isnan (x); float mag = fabsf (x); @@ -48,6 +52,7 @@ __roundevenf (float x) } return x; +#endif /* ! USE_ROUNDEVENF_BUILTIN */ } libm_alias_float (__roundeven, roundeven) diff --git a/sysdeps/riscv/rvf/s_roundf.c b/sysdeps/riscv/rvf/s_roundf.c index 735e7e9de9..db299e0a41 100644 --- a/sysdeps/riscv/rvf/s_roundf.c +++ b/sysdeps/riscv/rvf/s_roundf.c @@ -21,10 +21,14 @@ #include #include #include +#include float __roundf (float x) { +#if USE_ROUNDF_BUILTIN + return __builtin_roundf (x); +#else int flags = riscv_getflags (); bool nan = isnan (x); float mag = fabsf (x); @@ -48,6 +52,7 @@ __roundf (float x) } return x; +#endif /* ! USE_ROUNDF_BUILTIN */ } libm_alias_float (__round, round) diff --git a/sysdeps/riscv/rvf/s_truncf.c b/sysdeps/riscv/rvf/s_truncf.c index 0774f7cbd6..e2d99b20a8 100644 --- a/sysdeps/riscv/rvf/s_truncf.c +++ b/sysdeps/riscv/rvf/s_truncf.c @@ -21,10 +21,14 @@ #include #include #include +#include float __truncf (float x) { + #if USE_TRUNCF_BUILTIN + return __builtin_truncf (x); + #else int flags = riscv_getflags (); bool nan = isnan (x); float mag = fabsf (x); @@ -48,6 +52,7 @@ __truncf (float x) } return x; + #endif /* ! USE_TRUNCF_BUILTIN */ } libm_alias_float (__trunc, trunc)