This is the mail archive of the gcc-patches@gcc.gnu.org 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]

[PATCH] Fix PR middle-end/27134


Hello!

There is a problem in expand_builtin_int_roundingfn() when function
call expression for a fallback function with integer valued argument
is built.

As build_funcion_call_expr() folds BUILT_IN_FLOOR with integer valued
argument into NOP_EXPR (please look at fold_builtin(),
fold_builtin_floor() and fold_trunc_transparent_mathfn()), the
proposed solution is to handle NOP_EXPR case in
expand_builtin_int_roundingfn() by expanding argument of NOP_EXPR.

2005-04-13  Uros Bizjak  <uros@kss-loka.si>

        PR middle-end/27134
        * builtins.c (expand_builtin_int_roundingfn): Handle NOP_EXPR
        returned from build_function_call_expr() when argument
        to fallback rounding function is integer valued real number.

testsuite/ChangeLog:

2006-04-13  Uros Bizjak  <uros@kss-loka.si>

        PR middle-end/27134
        * gcc.dg/pr27314.c: New test.


Patch was regtested on i686-pc-linux-gnu for c and c++.

BTW: The generated code for pr27314.c is now (-O -mfpmath=sse -msse2
-ffast-math):

foo:
        cvtsi2sd  4(%esp), %xmm0
        cvttsd2si %xmm0, %eax
        ret

This code shows another optimization opportunity, as reported in PR
middle-end27139.

Uros.

Attachment: pr27134.diff
Description: Binary data


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