diff options
author | Marc Glisse <marc.glisse@inria.fr> | 2015-08-31 16:02:00 +0200 |
---|---|---|
committer | Marc Glisse <glisse@gcc.gnu.org> | 2015-08-31 14:02:00 +0000 |
commit | b0eb889bf88eff3316690c6397a7f3dc75fbeda7 (patch) | |
tree | a33c135ce9d2d8750a86956b05a1741e6d13de2e /gcc/tree.c | |
parent | f196d062919feaf10ec10c67ac0d20f15fcfd2f5 (diff) | |
download | gcc-b0eb889bf88eff3316690c6397a7f3dc75fbeda7.zip gcc-b0eb889bf88eff3316690c6397a7f3dc75fbeda7.tar.gz gcc-b0eb889bf88eff3316690c6397a7f3dc75fbeda7.tar.bz2 |
Move some comparison simplifications to match.pd
2015-08-31 Marc Glisse <marc.glisse@inria.fr>
gcc/
* tree.h (zerop): New function.
* tree.c (zerop): Likewise.
(element_precision): Handle expressions.
* match.pd (define_predicates): Add zerop.
(x <= +Inf): Fix comment.
(abs (x) == 0, A & C == C, A & C != 0): Converted from ...
* fold-const.c (fold_binary_loc): ... here. Remove.
gcc/testsuite/
* gcc.dg/tree-ssa/cmp-1.c: New file.
From-SVN: r227346
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -2215,6 +2215,17 @@ grow_tree_vec_stat (tree v, int len MEM_STAT_DECL) return v; } +/* Return 1 if EXPR is the constant zero, whether it is integral, float or + fixed, and scalar, complex or vector. */ + +int +zerop (const_tree expr) +{ + return (integer_zerop (expr) + || real_zerop (expr) + || fixed_zerop (expr)); +} + /* Return 1 if EXPR is the integer constant zero or a complex constant of zero. */ @@ -7512,6 +7523,8 @@ valid_constant_size_p (const_tree size) unsigned int element_precision (const_tree type) { + if (!TYPE_P (type)) + type = TREE_TYPE (type); enum tree_code code = TREE_CODE (type); if (code == COMPLEX_TYPE || code == VECTOR_TYPE) type = TREE_TYPE (type); |