aboutsummaryrefslogtreecommitdiff
path: root/gcc/value-range.h
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2023-04-28 09:01:35 +0200
committerJakub Jelinek <jakub@redhat.com>2023-04-28 09:04:33 +0200
commit9ffddbfc738a941ca3d32187a0e3f2616c7dd522 (patch)
tree8c7d6610015241b5df81fc27a2d57001c67b4035 /gcc/value-range.h
parentbd539c9b801bde3a919a5ad16b741ab4f5eca6e3 (diff)
downloadgcc-9ffddbfc738a941ca3d32187a0e3f2616c7dd522.zip
gcc-9ffddbfc738a941ca3d32187a0e3f2616c7dd522.tar.gz
gcc-9ffddbfc738a941ca3d32187a0e3f2616c7dd522.tar.bz2
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.
Diffstat (limited to 'gcc/value-range.h')
-rw-r--r--gcc/value-range.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/value-range.h b/gcc/value-range.h
index c37b6ef..0b61341 100644
--- a/gcc/value-range.h
+++ b/gcc/value-range.h
@@ -1388,4 +1388,7 @@ frange::nan_signbit_p (bool &signbit) const
return true;
}
+void frange_nextafter (enum machine_mode, REAL_VALUE_TYPE &,
+ const REAL_VALUE_TYPE &);
+
#endif // GCC_VALUE_RANGE_H