diff options
author | Andrew Pinski <apinski@marvell.com> | 2023-04-02 17:42:58 +0000 |
---|---|---|
committer | Andrew Pinski <apinski@marvell.com> | 2023-04-28 07:25:39 -0700 |
commit | b9b30dbaabc8076d9265cf685f45d3b0072a09df (patch) | |
tree | 971936d8407b4c072108e28bbe007a1e3589fce6 /gcc/fold-const.h | |
parent | 650c36ec461a722d9c65e82512b4c3aeec2ffee1 (diff) | |
download | gcc-b9b30dbaabc8076d9265cf685f45d3b0072a09df.zip gcc-b9b30dbaabc8076d9265cf685f45d3b0072a09df.tar.gz gcc-b9b30dbaabc8076d9265cf685f45d3b0072a09df.tar.bz2 |
MATCH: Factor out code that for min max detection with constants
This factors out some of the code from the min/max detection
from match.pd into a function so it can be reused in other
places. This is mainly used to detect the conversions
of >= to > which causes the integer values to be changed by
one.
Changes since v1:
* factor out the checks for INTEGER_CSTs so it is more obvious.
OK? Bootstrapped and tested on x86_64-linux-gnu.
gcc/ChangeLog:
* match.pd: Factor out the deciding the min/max from
the "(cond (cmp (convert1? x) c1) (convert2? x) c2)"
pattern to ...
* fold-const.cc (minmax_from_comparison): this new function.
* fold-const.h (minmax_from_comparison): New prototype.
Diffstat (limited to 'gcc/fold-const.h')
-rw-r--r-- | gcc/fold-const.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/fold-const.h b/gcc/fold-const.h index 56ecaa8..b828bad 100644 --- a/gcc/fold-const.h +++ b/gcc/fold-const.h @@ -246,6 +246,9 @@ extern tree fold_build_pointer_plus_hwi_loc (location_t loc, tree ptr, HOST_WIDE #define fold_build_pointer_plus_hwi(p,o) \ fold_build_pointer_plus_hwi_loc (UNKNOWN_LOCATION, p, o) +extern tree_code minmax_from_comparison (tree_code, tree, tree, + tree, tree); + /* In gimple-fold.cc. */ extern void clear_type_padding_in_mask (tree, unsigned char *); extern bool clear_padding_type_may_have_padding_p (tree); |