public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-3569] builtins: Add __builtin_nextafterf16b builtin Date: Mon, 31 Oct 2022 08:08:44 +0000 (GMT) [thread overview] Message-ID: <20221031080846.B24D2385AE43@sourceware.org> (raw) https://gcc.gnu.org/g:29490c2a1dc00944f2420eb59374705f180a2e53 commit r13-3569-g29490c2a1dc00944f2420eb59374705f180a2e53 Author: Jakub Jelinek <jakub@redhat.com> Date: Mon Oct 31 09:07:04 2022 +0100 builtins: Add __builtin_nextafterf16b builtin The following patch adds another needed builtin. The earlier patch adds among other things __builtin_nextafterf16 builtin which we need in order to constexpr evaluate std::nextafter(_Float16) overload (patch for that has been posted already). While there is inline implementation of the overload, it isn't constant evaluation friendly, and the builtin doesn't need libm implementation because it will be used only during constant expression evaluation. We need the same thing also for std::nextafter(__gnu_cxx::__bfloat16_t) though and this patch does that. 2022-10-31 Jakub Jelinek <jakub@redhat.com> * builtin-types.def (BT_FN_BFLOAT16_BFLOAT16_BFLOAT16): New. * builtins.def (BUILT_IN_NEXTAFTERF16B): New builtin. * fold-const-call.cc (fold_const_call_sss): Handle CFN_BUILT_IN_NEXTAFTERF16B. Diff: --- gcc/builtin-types.def | 2 ++ gcc/builtins.def | 1 + gcc/fold-const-call.cc | 1 + 3 files changed, 4 insertions(+) diff --git a/gcc/builtin-types.def b/gcc/builtin-types.def index 2dbed8ae05c..81460e1ed2b 100644 --- a/gcc/builtin-types.def +++ b/gcc/builtin-types.def @@ -461,6 +461,8 @@ DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT64X_FLOAT64X_FLOAT64X, BT_FLOAT64X, BT_FLOAT64X, BT_FLOAT64X) DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT128X_FLOAT128X_FLOAT128X, BT_FLOAT128X, BT_FLOAT128X, BT_FLOAT128X) +DEF_FUNCTION_TYPE_2 (BT_FN_BFLOAT16_BFLOAT16_BFLOAT16, + BT_BFLOAT16, BT_BFLOAT16, BT_BFLOAT16) DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT_FLOAT_FLOATPTR, BT_FLOAT, BT_FLOAT, BT_FLOAT_PTR) DEF_FUNCTION_TYPE_2 (BT_FN_DOUBLE_DOUBLE_DOUBLEPTR, diff --git a/gcc/builtins.def b/gcc/builtins.def index 42c005a7651..49973151bfe 100644 --- a/gcc/builtins.def +++ b/gcc/builtins.def @@ -591,6 +591,7 @@ DEF_C99_BUILTIN (BUILT_IN_NEXTAFTERF, "nextafterf", BT_FN_FLOAT_FLOAT_FLO DEF_C99_BUILTIN (BUILT_IN_NEXTAFTERL, "nextafterl", BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_ERRNO) #define NEXTAFTER_TYPE(F) BT_FN_##F##_##F##_##F DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_NEXTAFTER, "nextafter", NEXTAFTER_TYPE, ATTR_MATHFN_ERRNO) +DEF_GCC_BUILTIN (BUILT_IN_NEXTAFTERF16B, "nextafterf16b", BT_FN_BFLOAT16_BFLOAT16_BFLOAT16, ATTR_MATHFN_ERRNO) DEF_C99_BUILTIN (BUILT_IN_NEXTTOWARD, "nexttoward", BT_FN_DOUBLE_DOUBLE_LONGDOUBLE, ATTR_MATHFN_ERRNO) DEF_C99_BUILTIN (BUILT_IN_NEXTTOWARDF, "nexttowardf", BT_FN_FLOAT_FLOAT_LONGDOUBLE, ATTR_MATHFN_ERRNO) DEF_C99_BUILTIN (BUILT_IN_NEXTTOWARDL, "nexttowardl", BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_ERRNO) diff --git a/gcc/fold-const-call.cc b/gcc/fold-const-call.cc index 5f158152807..ab1b098d6ca 100644 --- a/gcc/fold-const-call.cc +++ b/gcc/fold-const-call.cc @@ -1438,6 +1438,7 @@ fold_const_call_sss (real_value *result, combined_fn fn, CASE_CFN_NEXTAFTER: CASE_CFN_NEXTAFTER_FN: + case CFN_BUILT_IN_NEXTAFTERF16B: CASE_CFN_NEXTTOWARD: return fold_const_nextafter (result, arg0, arg1, format);
reply other threads:[~2022-10-31 8:08 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20221031080846.B24D2385AE43@sourceware.org \ --to=jakub@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).