FAIL: gcc.dg/tree-ssa/range-sincos.c scan-tree-dump-not evrp "link_error" I assume this is due to the case that on s390 we have an isinf optab. Thus, prior evrp we end up with void bar (double x) { int _1; double _5; <bb 2> : _5 = sin (x_4(D)); if (_5 ord _5) goto <bb 3>; [INV] else goto <bb 5>; [INV] <bb 3> : _1 = __builtin_isinf (x_4(D)); if (_1 != 0) goto <bb 4>; [INV] else goto <bb 5>; [INV] <bb 4> : link_error (); <bb 5> : return; } whereas, e.g., on x86-64 we have void bar (double x) { double _1; double _7; <bb 2> : _7 = sin (x_6(D)); if (_7 ord _7) goto <bb 3>; [INV] else goto <bb 7>; [INV] <bb 3> : if (x_6(D) unord x_6(D)) goto <bb 4>; [INV] else goto <bb 5>; [INV] <bb 4> : link_error (); <bb 5> : _1 = ABS_EXPR <x_6(D)>; if (_1 u<= 1.79769313486231570814527423731704356798070567525844996599e+308) goto <bb 7>; [INV] else goto <bb 6>; [INV] <bb 6> : link_error (); <bb 7> : return; } If this optimization is all about ABS_EXPR the following patch would work on s390x and x86-64: @@ -24,20 +24,20 @@ bar (double x) { if (__builtin_isnan (x)) link_error (); - if (__builtin_isinf (x)) + if (__builtin_fabs (x) == __builtin_inf ()) link_error (); } } However, I'm not sure whether this is not also a missed optimization in case of an isinf optab?
I guess VRP should handle __builtin_isinf and friends.
(In reply to Richard Biener from comment #1) > I guess VRP should handle __builtin_isinf and friends. Like was posted here: https://gcc.gnu.org/pipermail/gcc-patches/2024-March/648303.html ?
Thanks for the pointer. I can confirm that the patch fixes this PR and also fixes FAIL: gcc.dg/tree-ssa/vrp-float-abs-1.c scan-tree-dump-not evrp "link_error"
Confirmed then. Maybe you should xfail it for s390 for GCC 14 at least and then unxfail when the patch is committed?
Ok, done in https://gcc.gnu.org/pipermail/gcc-patches/2024-April/649367.html
The master branch has been updated by HaoChen Gui <guihaoc@gcc.gnu.org>: https://gcc.gnu.org/g:cd0930768ff936b681135bf8873e7f7b796a4ed9 commit r15-2922-gcd0930768ff936b681135bf8873e7f7b796a4ed9 Author: Haochen Gui <guihaoc@gcc.gnu.org> Date: Thu Aug 15 11:19:10 2024 +0800 Value Range: Add range op for builtin isinf The builtin isinf is not folded at front end if the corresponding optab exists. So the range op for isinf is needed for value range analysis. This patch adds range op for builtin isinf. gcc/ PR target/114678 * gimple-range-op.cc (class cfn_isinf): New. (op_cfn_isinf): New variables. (gimple_range_op_handler::maybe_builtin_call): Handle CASE_FLT_FN (BUILT_IN_ISINF). gcc/testsuite/ PR target/114678 * gcc.dg/tree-ssa/range-isinf.c: New test. * gcc.dg/tree-ssa/range-sincos.c: Remove xfail for s390. * gcc.dg/tree-ssa/vrp-float-abs-1.c: Likewise.
Fixed.