aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorDorit Nuzman <dorit@il.ibm.com>2007-07-12 14:42:08 +0000
committerDorit Nuzman <dorit@gcc.gnu.org>2007-07-12 14:42:08 +0000
commit5b900a4c0ee38a66b04b4ceeecb8b194ddde7e57 (patch)
tree1d606e4397ee32cd9fe29b0165fe91119ff4fbc6 /gcc/expr.c
parent2df6377e6e01046582d489ae59b5be1371b42d59 (diff)
downloadgcc-5b900a4c0ee38a66b04b4ceeecb8b194ddde7e57.zip
gcc-5b900a4c0ee38a66b04b4ceeecb8b194ddde7e57.tar.gz
gcc-5b900a4c0ee38a66b04b4ceeecb8b194ddde7e57.tar.bz2
re PR target/25413 (wrong alignment or incorrect address computation in vectorized code on Pentium 4 SSE)
2007-07-12 Dorit Nuzman <dorit@il.ibm.com> Devang Patel <dpatel@apple.com> PR tree-optimization/25413 * targhooks.c (default_builtin_vector_alignment_reachable): New. * targhooks.h (default_builtin_vector_alignment_reachable): New. * tree.h (contains_packed_reference): New. * expr.c (contains_packed_reference): New. * tree-vect-analyze.c (vector_alignment_reachable_p): New. (vect_enhance_data_refs_alignment): Call vector_alignment_reachable_p. * target.h (vector_alignment_reachable): New builtin. * target-def.h (TARGET_VECTOR_ALIGNMENT_REACHABLE): New. * config/rs6000/rs6000.c (rs6000_vector_alignment_reachable): New. (TARGET_VECTOR_ALIGNMENT_REACHABLE): Define. Co-Authored-By: Devang Patel <dpatel@apple.com> From-SVN: r126591
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index 0739b05..cfc6ed1 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -5924,6 +5924,47 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize,
return exp;
}
+/* Given an expression EXP that may be a COMPONENT_REF or an ARRAY_REF,
+ look for whether EXP or any nested component-refs within EXP is marked
+ as PACKED. */
+
+bool
+contains_packed_reference (tree exp)
+{
+ bool packed_p = false;
+
+ while (1)
+ {
+ switch (TREE_CODE (exp))
+ {
+ case COMPONENT_REF:
+ {
+ tree field = TREE_OPERAND (exp, 1);
+ packed_p = DECL_PACKED (field)
+ || TYPE_PACKED (TREE_TYPE (field))
+ || TYPE_PACKED (TREE_TYPE (exp));
+ if (packed_p)
+ goto done;
+ }
+ break;
+
+ case BIT_FIELD_REF:
+ case ARRAY_REF:
+ case ARRAY_RANGE_REF:
+ case REALPART_EXPR:
+ case IMAGPART_EXPR:
+ case VIEW_CONVERT_EXPR:
+ break;
+
+ default:
+ goto done;
+ }
+ exp = TREE_OPERAND (exp, 0);
+ }
+ done:
+ return packed_p;
+}
+
/* Return a tree of sizetype representing the size, in bytes, of the element
of EXP, an ARRAY_REF. */