On 8/19/2026 5:48 PM, Andrea Pinski wrote:
This adds some simple non-negative support for some
builtins that return a real type.
There are 3 categories of functions:
* non-negative independent of arguments
* non-negative dependent on the first argument
* non-negative dependent on the first argument
and sets the nan-ness based on if the first argument contains a nan.
This is the first step in removing gimple_stmt_nonnegative_p or rather
moving it just use the current ranger rather than doing a recusive walk.
I have not added the functions which return an integer and a double value
yet. This will be done in a seperate patch.
For sinhatanh-3.c I had turn off jump threading otherwise there are more
copies of atanhl on x86_64 due to ATANHL being an optab and cdce would
create some conditions that could be jump threaded now. This is ok since
what this is testing to make sure the pattern added r9-4480-g4aff6d17446ade
in does not happen.
Bootstrapped and tested on x86_64-linux-gnu.
PR tree-optimization/126827
gcc/ChangeLog:
* gimple-range-op.cc (class cfn_fp_nonnegative): New class.
(class cfn_fp_nonnegative_arg0): New class.
(gimple_range_op_handler::maybe_builtin_call): Handle some
functions which were handled in nonnegative.
gcc/testsuite/ChangeLog:
* gcc.dg/sinhatanh-3.c: Turn off jump threading.
* gcc.dg/tree-ssa/ceil-1.c: New test.
Signed-off-by: Andrea Pinski <[email protected]>
OK.
jeff