This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, midlevel]: Convert (int)floor -> lfloor, take 2
- From: Roger Sayle <roger at eyesopen dot com>
- To: Uros Bizjak <uros at kss-loka dot si>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 8 Apr 2005 08:46:50 -0600 (MDT)
- Subject: Re: [PATCH, midlevel]: Convert (int)floor -> lfloor, take 2
On Fri, 8 Apr 2005, Uros Bizjak wrote:
> 2005-04-08 Uros Bizjak <uros@kss-loka.si>
>
> * builtins.def (BUILT_IN_LFLOOR, BUILT_IN_LFLOORF, BUILT_IN_LFLOORL)
> (BUILT_IN_LLFLOOR, BUILT_IN_LLFLOORF, BUILT_IN_LLFLOORL): New.
> * optabs.h (enum optab_index): Add new OTI_lfloor.
> (lfloor_optab): Define corresponding macro.
> * optabs.c (init_optabs): Initialize lfloor_optab.
> * genopinit.c (optabs): Implement lfloor_optab using lfloorsi2
> and lfloordi2 patterns.
>
> * builtins.c (expand_builtin_int_roundingfn): New prototype.
> (expand_builtin_int_roundingfn): New function.
> (fold_builtin_int_roundingfn): New prototype.
> (fold_builtin_int_roundingfn): New function, renamed from
> fold_builtin_lround.
> Handle BUILT_IN_LROUND{,F,L}, BUILT_IN_LLROUND{,F,L} and
> BUILT_IN_LFLOOR{,F,L}, BUILT_IN_LLFLOOR{,F,L}.
> (fold_builtin_1): Fold BUILT_IN_LFLOOR{,F,L} and
> BUILT_IN_LLFLOOR{,F,L} using fold_builtin_int_roundingfn.
> (mathfn_built_in): Handle BUILT_IN LFLOOR and BUILT_IN_LLFLOOR.
> (expand_builtin): Expand BUILT_IN_LFLOOR{,F,L} and
> BUILT_IN_LLFLOOR{,F,L} using expand_builtin_int_roundingfn.
>
> * convert.c (convert_to_integer): Convert (long int)floor{,f,l},
> into lfloor built-in function and (long long int)floor{,f,l} into
> llfloor built-in-function.
> * fold-const.c (tree_expr_nonnegative_p): Add BUILT_IN_LFLOOR and
> BUILT_IN_LLFLOOR.
>
> testsuite:
>
> * gcc.dg/builtins-53.c: New test.
Excellent. Your revised expand_builtin_int_roundingfn is much prettier
than the previous attempt. All of the above patch, including the new
testcase, is OK for mainline. Hopefully, RTH will review the backend
bits, now that the necessary infrastructure is in place.
Thanks once again.
Roger
--