Bug 34245 - Missing __builtin_fpclassify
Summary: Missing __builtin_fpclassify
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.3.0
: P3 enhancement
Target Milestone: 4.4.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-27 11:46 UTC by Paolo Carlini
Modified: 2009-07-24 09:07 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2007-11-27 12:49:12


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paolo Carlini 2007-11-27 11:46:03 UTC
Builtins for all the other floating-point classification macros are already implemented and it would be nice to complete the set with __builtin_fpclassify (could be certainly exploited in libstdc++, also)
Comment 1 Richard Biener 2007-11-27 12:49:12 UTC
Confirmed.
Comment 2 jsm-csl@polyomino.org.uk 2007-11-27 15:34:48 UTC
Subject: Re:   New: Missing __builtin_fpclassify

As previously discussed, this builtin would either need to be used in the 
form

#define fpclassify(x) __builtin_fpclassify(FP_INFINITE, FP_NAN, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, (x))

or would need GCC to be configured with target-specific information about 
FP_*, since the values of the FP_* macros are not standardized.

Comment 3 Paolo Carlini 2007-11-27 16:00:55 UTC
(In reply to comment #2)
> As previously discussed,

Didn't know about that. If you have a pointer, I would like to read the thread.

                           this builtin would either need to be used in the 
> form
> 
> #define fpclassify(x) __builtin_fpclassify(FP_INFINITE, FP_NAN, FP_NORMAL,
> FP_SUBNORMAL, FP_ZERO, (x))

In my opinion, this would be already a nice improvement.

> or would need GCC to be configured with target-specific information about 
> FP_*, since the values of the FP_* macros are not standardized.

I see. At the moment, I'm not able to understand whether that is a major / controversial change... I would appreciate some additional details, if possible. Thanks.
Comment 4 jsm-csl@polyomino.org.uk 2007-11-27 16:20:22 UTC
Subject: Re:  Missing __builtin_fpclassify

On Tue, 27 Nov 2007, pcarlini at suse dot de wrote:

> > As previously discussed,
> 
> Didn't know about that. If you have a pointer, I would like to read the thread.

http://gcc.gnu.org/ml/gcc-patches/2007-01/msg02210.html

Comment 5 Paolo Carlini 2009-07-24 09:07:22 UTC
Implemented here:

2008-05-23  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* builtin-types.def (BT_FN_INT_INT_INT_INT_INT_INT_VAR): New.
	* builtins.c (fold_builtin_fpclassify): New.
	(fold_builtin_varargs): Handle BUILT_IN_FPCLASSIFY.
	* builtins.def (BUILT_IN_FPCLASSIFY): New.
	* c-common.c (handle_type_generic_attribute): Adjust to accept
	fixed arguments before an elipsis.
	(check_builtin_function_arguments): Handle BUILT_IN_FPCLASSIFY.
	* doc/extend.texi: Document __builtin_fpclassify.