]> gcc.gnu.org Git - gcc.git/commit
Implement range-op entry for sin/cos
authorJakub Jelinek <jakub@redhat.com>
Fri, 28 Apr 2023 07:01:35 +0000 (09:01 +0200)
committerJakub Jelinek <jakub@redhat.com>
Fri, 28 Apr 2023 07:04:33 +0000 (09:04 +0200)
commit9ffddbfc738a941ca3d32187a0e3f2616c7dd522
tree8c7d6610015241b5df81fc27a2d57001c67b4035
parentbd539c9b801bde3a919a5ad16b741ab4f5eca6e3
Implement range-op entry for sin/cos

On Tue, Apr 18, 2023 at 03:12:50PM +0200, Aldy Hernandez wrote:
> [I don't know why I keep poking at floats.  I must really like the pain.
>
> This is the range-op entry for sin/cos.  It is meant to serve as an
> example of what we can do for glibc math functions.  It is by no means
> exhaustive, just a stub to restrict the return range from sin/cos to
> [-1.0, 1.0] with appropriate smarts of NANs.
>
> As can be seen in the testcase, we see sin() as well as
> __builtin_sin() in the IL, and can resolve the resulting range
> accordingly.

Here is an updated version of the patch on top of the
Add targetm.libm_function_max_error
patch with all my comments incorporated into your patch (but still no
handling of sin/cos ranges shorter than 2*M_PI).

2023-04-28  Aldy Hernandez  <aldyh@redhat.com>
    Jakub Jelinek  <jakub@redhat.com>

* value-range.h (frange_nextafter): Declare.
* gimple-range-op.cc (class cfn_sincos): New.
(op_cfn_sin, op_cfn_cos): New variables.
(gimple_range_op_handler::maybe_builtin_call): Handle
CASE_CFN_{SIN,COS}{,_FN}.

* gcc.dg/tree-ssa/range-sincos.c: New test.
gcc/gimple-range-op.cc
gcc/testsuite/gcc.dg/tree-ssa/range-sincos.c [new file with mode: 0644]
gcc/value-range.h
This page took 0.074989 seconds and 6 git commands to generate.