summaryrefslogtreecommitdiff
path: root/gcc/gimple-fold.c
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2012-09-17 05:30:37 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2012-09-17 05:30:37 +0000
commit51d619308377f16a8ff13df95becfe2282198844 (patch)
tree21b147aea83b41c5c37fba84ea32c18f1c7de253 /gcc/gimple-fold.c
parent9b39d7e80300d4a7fc3399d0896881027479b72a (diff)
downloadgcc-51d619308377f16a8ff13df95becfe2282198844.tar.gz
2012-09-17 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 191371 using svnmerge. [gcc/] 2012-09-17 Basile Starynkevitch <basile@starynkevitch.net> {{when merging trunk svn rev 191371}} * melt-runtime.c (melt_load_module_index): Push an empty slot, not a null pointer, into melt_modinfvec. (meltgc_run_c_extension): Push an empty slot, not a null pointer, into melt_extinfvec. (melt_really_initialize): Better indentation, and increase maximal minore size to 32768Kwords. Push an empty slot, not a null pointer, into melt_modinfvec. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@191373 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimple-fold.c')
-rw-r--r--gcc/gimple-fold.c35
1 files changed, 29 insertions, 6 deletions
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c
index 42bc0fcb83a..4dba726f274 100644
--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -30,6 +30,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-ssa-propagate.h"
#include "target.h"
#include "gimple-fold.h"
+#include "langhooks.h"
/* Return true when DECL can be referenced from current unit.
FROM_DECL (if non-null) specify constructor of variable DECL was taken from.
@@ -154,13 +155,15 @@ canonicalize_constructor_val (tree cval, tree from_decl)
}
if (TREE_CODE (cval) == ADDR_EXPR)
{
- tree base = get_base_address (TREE_OPERAND (cval, 0));
- if (!base && TREE_CODE (TREE_OPERAND (cval, 0)) == COMPOUND_LITERAL_EXPR)
+ tree base = NULL_TREE;
+ if (TREE_CODE (TREE_OPERAND (cval, 0)) == COMPOUND_LITERAL_EXPR)
{
base = COMPOUND_LITERAL_EXPR_DECL (TREE_OPERAND (cval, 0));
if (base)
TREE_OPERAND (cval, 0) = base;
}
+ else
+ base = get_base_address (TREE_OPERAND (cval, 0));
if (!base)
return NULL_TREE;
@@ -1690,6 +1693,16 @@ static tree
and_comparisons_1 (enum tree_code code1, tree op1a, tree op1b,
enum tree_code code2, tree op2a, tree op2b)
{
+ tree truth_type = boolean_type_node;
+ if (TREE_CODE (TREE_TYPE (op1a)) == VECTOR_TYPE)
+ {
+ tree vec_type = TREE_TYPE (op1a);
+ tree elem = lang_hooks.types.type_for_size
+ (GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (vec_type))), 0);
+ truth_type = build_opaque_vector_type (elem,
+ TYPE_VECTOR_SUBPARTS (vec_type));
+ }
+
/* First check for ((x CODE1 y) AND (x CODE2 y)). */
if (operand_equal_p (op1a, op2a, 0)
&& operand_equal_p (op1b, op2b, 0))
@@ -1697,7 +1710,7 @@ and_comparisons_1 (enum tree_code code1, tree op1a, tree op1b,
/* Result will be either NULL_TREE, or a combined comparison. */
tree t = combine_comparisons (UNKNOWN_LOCATION,
TRUTH_ANDIF_EXPR, code1, code2,
- boolean_type_node, op1a, op1b);
+ truth_type, op1a, op1b);
if (t)
return t;
}
@@ -1710,7 +1723,7 @@ and_comparisons_1 (enum tree_code code1, tree op1a, tree op1b,
tree t = combine_comparisons (UNKNOWN_LOCATION,
TRUTH_ANDIF_EXPR, code1,
swap_tree_comparison (code2),
- boolean_type_node, op1a, op1b);
+ truth_type, op1a, op1b);
if (t)
return t;
}
@@ -2152,6 +2165,16 @@ static tree
or_comparisons_1 (enum tree_code code1, tree op1a, tree op1b,
enum tree_code code2, tree op2a, tree op2b)
{
+ tree truth_type = boolean_type_node;
+ if (TREE_CODE (TREE_TYPE (op1a)) == VECTOR_TYPE)
+ {
+ tree vec_type = TREE_TYPE (op1a);
+ tree elem = lang_hooks.types.type_for_size
+ (GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (vec_type))), 0);
+ truth_type = build_opaque_vector_type (elem,
+ TYPE_VECTOR_SUBPARTS (vec_type));
+ }
+
/* First check for ((x CODE1 y) OR (x CODE2 y)). */
if (operand_equal_p (op1a, op2a, 0)
&& operand_equal_p (op1b, op2b, 0))
@@ -2159,7 +2182,7 @@ or_comparisons_1 (enum tree_code code1, tree op1a, tree op1b,
/* Result will be either NULL_TREE, or a combined comparison. */
tree t = combine_comparisons (UNKNOWN_LOCATION,
TRUTH_ORIF_EXPR, code1, code2,
- boolean_type_node, op1a, op1b);
+ truth_type, op1a, op1b);
if (t)
return t;
}
@@ -2172,7 +2195,7 @@ or_comparisons_1 (enum tree_code code1, tree op1a, tree op1b,
tree t = combine_comparisons (UNKNOWN_LOCATION,
TRUTH_ORIF_EXPR, code1,
swap_tree_comparison (code2),
- boolean_type_node, op1a, op1b);
+ truth_type, op1a, op1b);
if (t)
return t;
}