[PATCH] Fix PR middle-end/27134

Uros Bizjak ubizjak@gmail.com
Thu Apr 13 11:43:00 GMT 2006


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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr27134.diff
Type: application/octet-stream
Size: 1285 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20060413/507009fc/attachment.obj>


More information about the Gcc-patches mailing list