Builtin function roundeven folding implementation
authorTejas Joshi <tejasjoshi9673@gmail.com>
Mon, 26 Aug 2019 12:32:29 +0000 (12:32 +0000)
committerMartin Jambor <jamborm@gcc.gnu.org>
Mon, 26 Aug 2019 12:32:29 +0000 (14:32 +0200)
commit7d7b99f95bf2517caab5f9300090b471135b4fc0
treec215f66b35c9f3508ceb670fbaeae05b7d223c3d
parent48a31a09839b12127ce7c40d7adc4bd5bf1d3407
Builtin function roundeven folding implementation

2019-08-26  Tejas Joshi  <tejasjoshi9673@gmail.com>

        * builtins.c (mathfn_built_in_2): Added CASE_MATHFN_FLOATN
        for ROUNDEVEN.
        * builtins.def: Added function definitions for roundeven function
        variants.
        * fold-const-call.c (fold_const_call_ss): Added case for roundeven
        function call.  Adjust condition for floor, ceil, trunc and round.
        * fold-const.c (negate_mathfn_p): Added case for roundeven function.
        (tree_call_nonnegative_warnv_p): Added case for roundeven function.
        (integer_valued_real_call_p): Added case for roundeven function.
        * real.c (is_even): New function. Returns true if real number is even,
        otherwise returns false.
        (is_halfway_below): New function. Returns true if real number is
        halfway between two integers, else return false.
        (real_roundeven): New function. Round real number to nearest integer,
        rounding halfway cases towards even.
        * real.h (real_value): Added descriptive comments.  Added function
        declaration for roundeven function.
        * doc/extend.texi (Other Builtins): List roundeven variants among
        functions which can be handled as builtins.

gcc/testsuite/ChangeLog:

2019-08-26  Tejas Joshi  <tejasjoshi9673@gmail.com>

        * gcc.dg/torture/builtin-round-roundeven.c: New test.
        * gcc.dg/torture/builtin-round-roundevenf128.c: New test.

From-SVN: r274927
gcc/ChangeLog
gcc/builtins.c
gcc/builtins.def
gcc/doc/extend.texi
gcc/fold-const-call.c
gcc/fold-const.c
gcc/real.c
gcc/real.h
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/builtin-round-roundeven.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/torture/builtin-round-roundevenf128.c [new file with mode: 0644]