aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorMarc Glisse <marc.glisse@inria.fr>2015-07-06 20:19:41 +0200
committerMarc Glisse <glisse@gcc.gnu.org>2015-07-06 18:19:41 +0000
commit8b5ee871d270b8a174bc9309688337a21fc4cce4 (patch)
tree9b00cc78be393b3fe6c2a7993ef46913e3db86b8 /gcc/tree.c
parent45cef0e94d10063aa847530d5e8ba79bb320be28 (diff)
downloadgcc-8b5ee871d270b8a174bc9309688337a21fc4cce4.zip
gcc-8b5ee871d270b8a174bc9309688337a21fc4cce4.tar.gz
gcc-8b5ee871d270b8a174bc9309688337a21fc4cce4.tar.bz2
match.pd: Remove element_mode inside HONOR_*.
2015-07-06 Marc Glisse <marc.glisse@inria.fr> * match.pd: Remove element_mode inside HONOR_*. (~ (-A) -> A - 1, ~ (A - 1) -> -A): Handle complex types. (~X | X -> -1, ~X ^ X -> -1): Merge. * tree.c (build_each_one_cst): New function. * tree.h (build_each_one_cst): Likewise. From-SVN: r225473
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 6628a38..c0e2b0a 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -1968,6 +1968,21 @@ build_complex (tree type, tree real, tree imag)
return t;
}
+/* Return the constant 1 in type TYPE. If TYPE has several elements, each
+ element is set to 1. In particular, this is 1 + i for complex types. */
+
+tree
+build_each_one_cst (tree type)
+{
+ if (TREE_CODE (type) == COMPLEX_TYPE)
+ {
+ tree scalar = build_one_cst (TREE_TYPE (type));
+ return build_complex (type, scalar, scalar);
+ }
+ else
+ return build_one_cst (type);
+}
+
/* Return a constant of arithmetic type TYPE which is the
multiplicative identity of the set TYPE. */