aboutsummaryrefslogtreecommitdiff
path: root/gcc/function.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2021-05-18 10:08:51 +0200
committerJakub Jelinek <jakub@redhat.com>2021-05-18 10:08:51 +0200
commit65061ea287a80cfb214e402cfd2373a14bfec95a (patch)
tree1f99a7d4ffd69642018df6da8b634301e0fce7ef /gcc/function.c
parentb2a09773155892e426b90ce8367e2ed6996b44ef (diff)
downloadgcc-65061ea287a80cfb214e402cfd2373a14bfec95a.zip
gcc-65061ea287a80cfb214e402cfd2373a14bfec95a.tar.gz
gcc-65061ea287a80cfb214e402cfd2373a14bfec95a.tar.bz2
phiopt: Optimize partial_ordering spaceship >= 0 -ffinite-math-only [PR94589]
As mentioned earlier, spaceship_replacement didn't optimize partial_ordering >= 0 comparisons, because the possible values are -1, 0, 1, 2 and the >= comparison is implemented as (res & 1) == res to choose the 0 and 1 cases from that. As we optimize that only with -ffinite-math-only, the 2 case is assumed not to happen and my earlier match.pd change optimizes (res & 1) == res into (res & ~1) == 0, so this patch pattern matches that case and handles it like res >= 0. 2021-05-18 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/94589 * tree-ssa-phiopt.c (spaceship_replacement): Pattern match phi result used in (res & ~1) == 0 comparison as res >= 0 as res == 2 would be UB with -ffinite-math-only. * g++.dg/opt/pr94589-2.C: Adjust scan-tree-dump count from 14 to 12.
Diffstat (limited to 'gcc/function.c')
0 files changed, 0 insertions, 0 deletions