public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <jeffreyalaw@gmail.com>
To: Jakub Jelinek <jakub@redhat.com>,
	"Joseph S. Myers" <joseph@codesourcery.com>,
	Richard Biener <rguenther@suse.de>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] builtins: Add various __builtin_*f{16,32,64,128,32x,64x,128x} builtins
Date: Fri, 28 Oct 2022 22:53:16 -0600	[thread overview]
Message-ID: <ec20dcf0-caa7-f692-c2ff-5dd55947a506@gmail.com> (raw)
In-Reply-To: <Y0vYOUijciWziskx@tucnak>


On 10/16/22 04:09, Jakub Jelinek wrote:
> Hi!
>
> When working on libstdc++ extended float support in <cmath>, I found that
> we need various builtins for the _Float{16,32,64,128,32x,64x,128x} types.
> Glibc 2.26 and later provides the underlying libm routines (except for
> _Float16 and _Float128x for the time being) and in libstdc++ I think we
> need at least the _Float128 builtins on x86_64, i?86, powerpc64le and ia64
> (when long double is IEEE quad, we can handle it by using __builtin_*l
> instead), because without the builtins the overloads couldn't be constexpr
> (say when it would declare the *f128 extern "C" routines itself and call
> them).
>
> The testcase covers just types of those builtins and their constant
> folding, so doesn't need actual libm support.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2022-10-15  Jakub Jelinek  <jakub@redhat.com>
>
> 	* builtin-types.def (BT_FLOAT16_PTR, BT_FLOAT32_PTR, BT_FLOAT64_PTR,
> 	BT_FLOAT128_PTR, BT_FLOAT32X_PTR, BT_FLOAT64X_PTR, BT_FLOAT128X_PTR):
> 	New DEF_PRIMITIVE_TYPE.
> 	(BT_FN_INT_FLOAT16, BT_FN_INT_FLOAT32, BT_FN_INT_FLOAT64,
> 	BT_FN_INT_FLOAT128, BT_FN_INT_FLOAT32X, BT_FN_INT_FLOAT64X,
> 	BT_FN_INT_FLOAT128X, BT_FN_LONG_FLOAT16, BT_FN_LONG_FLOAT32,
> 	BT_FN_LONG_FLOAT64, BT_FN_LONG_FLOAT128, BT_FN_LONG_FLOAT32X,
> 	BT_FN_LONG_FLOAT64X, BT_FN_LONG_FLOAT128X, BT_FN_LONGLONG_FLOAT16,
> 	BT_FN_LONGLONG_FLOAT32, BT_FN_LONGLONG_FLOAT64,
> 	BT_FN_LONGLONG_FLOAT128, BT_FN_LONGLONG_FLOAT32X,
> 	BT_FN_LONGLONG_FLOAT64X, BT_FN_LONGLONG_FLOAT128X): New
> 	DEF_FUNCTION_TYPE_1.
> 	(BT_FN_FLOAT16_FLOAT16_FLOAT16PTR, BT_FN_FLOAT32_FLOAT32_FLOAT32PTR,
> 	BT_FN_FLOAT64_FLOAT64_FLOAT64PTR, BT_FN_FLOAT128_FLOAT128_FLOAT128PTR,
> 	BT_FN_FLOAT32X_FLOAT32X_FLOAT32XPTR,
> 	BT_FN_FLOAT64X_FLOAT64X_FLOAT64XPTR,
> 	BT_FN_FLOAT128X_FLOAT128X_FLOAT128XPTR, BT_FN_FLOAT16_FLOAT16_INT,
> 	BT_FN_FLOAT32_FLOAT32_INT, BT_FN_FLOAT64_FLOAT64_INT,
> 	BT_FN_FLOAT128_FLOAT128_INT, BT_FN_FLOAT32X_FLOAT32X_INT,
> 	BT_FN_FLOAT64X_FLOAT64X_INT, BT_FN_FLOAT128X_FLOAT128X_INT,
> 	BT_FN_FLOAT16_FLOAT16_INTPTR, BT_FN_FLOAT32_FLOAT32_INTPTR,
> 	BT_FN_FLOAT64_FLOAT64_INTPTR, BT_FN_FLOAT128_FLOAT128_INTPTR,
> 	BT_FN_FLOAT32X_FLOAT32X_INTPTR, BT_FN_FLOAT64X_FLOAT64X_INTPTR,
> 	BT_FN_FLOAT128X_FLOAT128X_INTPTR, BT_FN_FLOAT16_FLOAT16_LONG,
> 	BT_FN_FLOAT32_FLOAT32_LONG, BT_FN_FLOAT64_FLOAT64_LONG,
> 	BT_FN_FLOAT128_FLOAT128_LONG, BT_FN_FLOAT32X_FLOAT32X_LONG,
> 	BT_FN_FLOAT64X_FLOAT64X_LONG, BT_FN_FLOAT128X_FLOAT128X_LONG): New
> 	DEF_FUNCTION_TYPE_2.
> 	(BT_FN_FLOAT16_FLOAT16_FLOAT16_INTPTR,
> 	BT_FN_FLOAT32_FLOAT32_FLOAT32_INTPTR,
> 	BT_FN_FLOAT64_FLOAT64_FLOAT64_INTPTR,
> 	BT_FN_FLOAT128_FLOAT128_FLOAT128_INTPTR,
> 	BT_FN_FLOAT32X_FLOAT32X_FLOAT32X_INTPTR,
> 	BT_FN_FLOAT64X_FLOAT64X_FLOAT64X_INTPTR,
> 	BT_FN_FLOAT128X_FLOAT128X_FLOAT128X_INTPTR): New DEF_FUNCTION_TYPE_3.
> 	* builtins.def (ACOSH_TYPE, ATAN2_TYPE, ATANH_TYPE, COSH_TYPE,
> 	FDIM_TYPE, HUGE_VAL_TYPE, HYPOT_TYPE, ILOGB_TYPE, LDEXP_TYPE,
> 	LGAMMA_TYPE, LLRINT_TYPE, LOG10_TYPE, LRINT_TYPE, MODF_TYPE,
> 	NEXTAFTER_TYPE, REMQUO_TYPE, SCALBLN_TYPE, SCALBN_TYPE, SINH_TYPE):
> 	Define and undefine later.
> 	(FMIN_TYPE, SQRT_TYPE): Undefine at a later line.
> 	(INF_TYPE): Define at a later line.
> 	(BUILT_IN_ACOSH, BUILT_IN_ACOS, BUILT_IN_ASINH, BUILT_IN_ASIN,
> 	BUILT_IN_ATAN2, BUILT_IN_ATANH, BUILT_IN_ATAN, BUILT_IN_CBRT,
> 	BUILT_IN_COSH, BUILT_IN_COS, BUILT_IN_ERFC, BUILT_IN_ERF,
> 	BUILT_IN_EXP2, BUILT_IN_EXP, BUILT_IN_EXPM1, BUILT_IN_FDIM,
> 	BUILT_IN_FMOD, BUILT_IN_FREXP, BUILT_IN_HYPOT, BUILT_IN_ILOGB,
> 	BUILT_IN_LDEXP, BUILT_IN_LGAMMA, BUILT_IN_LLRINT, BUILT_IN_LLROUND,
> 	BUILT_IN_LOG10, BUILT_IN_LOG1P, BUILT_IN_LOG2, BUILT_IN_LOGB,
> 	BUILT_IN_LOG, BUILT_IN_LRINT, BUILT_IN_LROUND, BUILT_IN_MODF,
> 	BUILT_IN_NEXTAFTER, BUILT_IN_POW, BUILT_IN_REMAINDER, BUILT_IN_REMQUO,
> 	BUILT_IN_SCALBLN, BUILT_IN_SCALBN, BUILT_IN_SINH, BUILT_IN_SIN,
> 	BUILT_IN_TANH, BUILT_IN_TAN, BUILT_IN_TGAMMA): Add
> 	DEF_EXT_LIB_FLOATN_NX_BUILTINS.
> 	(BUILT_IN_HUGE_VAL): Use HUGE_VAL_TYPE instead of INF_TYPE in
> 	DEF_GCC_FLOATN_NX_BUILTINS.
> 	* fold-const-call.cc (fold_const_call_ss): Add various CASE_CFN_*_FN:
> 	cases when CASE_CFN_* is present.
> 	(fold_const_call_sss): Likewise.
> 	* builtins.cc (mathfn_built_in_2): Use CASE_MATHFN_FLOATN instead of
> 	CASE_MATHFN for various builtins in SEQ_OF_CASE_MATHFN macro.
> 	(builtin_with_linkage_p): Add CASE_FLT_FN_FLOATN_NX for various
> 	builtins next to CASE_FLT_FN.
> 	* fold-const.cc (tree_call_nonnegative_warnv_p): Add CASE_CFN_*_FN:
> 	next to CASE_CFN_*: for various builtins.
> 	* tree-call-cdce.cc (can_test_argument_range): Add
> 	CASE_FLT_FN_FLOATN_NX next to CASE_FLT_FN for various builtins.
> 	(edom_only_function): Likewise.
>
> 	* gcc.dg/torture/floatn-builtin.h: Add tests for newly added builtins.

OK.

jeff



      reply	other threads:[~2022-10-29  4:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-16 10:09 Jakub Jelinek
2022-10-29  4:53 ` Jeff Law [this message]

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=ec20dcf0-caa7-f692-c2ff-5dd55947a506@gmail.com \
    --to=jeffreyalaw@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=rguenther@suse.de \
    /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: link
Be 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).