diff options
author | Jakub Jelinek <jakub@redhat.com> | 2024-05-13 11:15:27 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2024-05-13 11:17:41 +0200 |
commit | b621482296f6dec0abb22ed39cc4ce6811535d47 (patch) | |
tree | 40ed7f8c89d3fcae71c25757f86faa44009c9eed /libgcc | |
parent | f3f02a750c7b34b751fa809ab03d29b2ccf0785d (diff) | |
download | gcc-b621482296f6dec0abb22ed39cc4ce6811535d47.zip gcc-b621482296f6dec0abb22ed39cc4ce6811535d47.tar.gz gcc-b621482296f6dec0abb22ed39cc4ce6811535d47.tar.bz2 |
tree-ssa-math-opts: Pattern recognize yet another .ADD_OVERFLOW pattern [PR113982]
We pattern recognize already many different patterns, and closest to the
requested one also
yc = (type) y;
zc = (type) z;
x = yc + zc;
w = (typeof_y) x;
if (x > max)
where y/z has the same unsigned type and type is a wider unsigned type
and max is maximum value of the narrower unsigned type.
But apparently people are creative in writing this in diffent ways,
this requests
yc = (type) y;
zc = (type) z;
x = yc + zc;
w = (typeof_y) x;
if (x >> narrower_type_bits)
The following patch implements that.
2024-05-13 Jakub Jelinek <jakub@redhat.com>
PR middle-end/113982
* tree-ssa-math-opts.cc (arith_overflow_check_p): Also return 1
for RSHIFT_EXPR by precision of maxval if shift result is only
used in a cast or comparison against zero.
(match_arith_overflow): Handle the RSHIFT_EXPR use case.
* gcc.dg/pr113982.c: New test.
Diffstat (limited to 'libgcc')
0 files changed, 0 insertions, 0 deletions