This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC Patch]: Implement remainder() as built-in function [PR fortran/24518]

Hi Uros,

On Tue, 24 Oct 2006, Uros Bizjak wrote:
> 2006-10-24  Uros Bizjak  <>
> 	* optabs.h (enum optab_index): Rename OTI_drem to OTI_remainder.
> 	(remainder_optab): Define corresponding macro.
> 	(drem_optab): Remove.
> 	* optabs.c (init_optabs): Initialize remainder_optab.  Remove
> 	drem_optab initialization.
> 	* genopinit.c (optabs): Implement remainder_optab using
> 	remainder?f3 patterns.  Remove drem_optab.
> 	* builtins.c (expand_builtin_mathfn_2): Handle
> 	BUILT_IN_REMAINDER{,F,L} using remainder_optab.
> 	(expand_builtin): Expand BUILT_IN_REMAINDER{,F,L} using
> 	expand_builtin_mathfn_2.
> 	(expand_builtin) [BUILT_IN_FMOD], [BUILT_IN_DREM]: Do not
> 	depend on flag_unsafe_math_optimizations.
> 	* config/i386/ ("remaindersf3", "remainderdf3")
> 	("remainderxf3"): Renamed from "drem{s,d,x}f3" expanders.
> 	Do not depend on flag_unsafe_math_optimizations.  Use
> 	truncxf?f expander instead of truncxf?f_i387_noop.
> 	("fpremxf4", "fprem1xf4"): Do not depend on
> 	flag_unsafe_math_optimizations.
> 	("fmodsf3", "fmoddf3", "fmodxf3"): Do not depend on
> 	flag_unsafe_math_optimizations.  Use truncxf?f expander
> 	instead of truncxf?f_i387_noop.
> testsuite/ChangeLog:
> 	* gcc.dg/builtins-40.c: Also check remainder(), remainderf()
> 	and remainderl() built-in functions.  Remove -ffast-math from
> 	dg-options.

Thanks for making these changes.  This revised patch is OK for mainline.

There is however one pre-existing niggle.  I was suprised that none
of the named patterns touched by your patch are currently documented
in md.texi.  You'll notice that sqrt@var{m}2 and cos@var{m}2 are, but
fmod@var{m}3 and the now obsolete drem@var{m}3 aren't.  Hence, I shouldn't
be too harsh that you don't document the new "remainder@var{m}3" named
pattern (or update the non-existent documentation for drem :-).

I don't think this missing documentation should hold-up your patch
(as it's a pre-existing issue), but it'd be nice if you could compose
something as a follow-up documentation patch.  Pretty please.

Hmm.  Perhaps if one of the texi wizards or documentation maintainers
can recommend how best to break up the single large @table in
"@section Standard Pattern Names For Generation", we could introduce
subsections for different classes of patterns.  At the moment named
patterns appear to be in arbitrary order, with a vague preference
for related patterns appearing close together.  Perhaps once we have
subsections, floating point intrinsics (such as sqrt, exp, cos, sin,
etc...) could be sorted alphabetically, making them easier to find.

Thanks again in advance.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]