MATCH: [PR111109] Fix bit_ior(cond,cond) when comparisons are fp
commit4aa14ec7d5b25722e4d02c29c8c1e22dcc5a4915
authorAndrew Pinski <apinski@marvell.com>
Wed, 23 Aug 2023 16:46:10 +0000 (23 16:46 +0000)
committerAndrew Pinski <apinski@marvell.com>
Thu, 24 Aug 2023 07:20:50 +0000 (24 07:20 +0000)
treec7c5c10048aa3dc9a8748fb47a008fcdc396b97e
parentddd64a6ec3b38e18aefb9fcba50c0d9297e5e711
MATCH: [PR111109] Fix bit_ior(cond,cond) when comparisons are fp

The patterns that were added in r13-4620-g4d9db4bdd458, missed that
(a > b) and (a <= b) are not inverse of each other for floating point
comparisons (if NaNs are supported). Even though there was a check for
intergal types, it was only for the result of the cond rather for the
type of what is being compared. The fix is to check to see if cmp and
icmp are inverse of each other by using the invert_tree_comparison function.

OK for trunk and GCC 13 branch? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

I added the testcase to execute/ieee as it requires support for NAN.

PR tree-optimization/111109

gcc/ChangeLog:

* match.pd (ior(cond,cond), ior(vec_cond,vec_cond)):
Add check to make sure cmp and icmp are inverse.

gcc/testsuite/ChangeLog:

* gcc.c-torture/execute/ieee/fp-cmp-cond-1.c: New test.
gcc/match.pd
gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-cond-1.c [new file with mode: 0644]