aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDorit Nuzman <dorit@il.ibm.com>2007-07-24 09:20:50 +0000
committerDorit Nuzman <dorit@gcc.gnu.org>2007-07-24 09:20:50 +0000
commit99c9c69acb9150b1b93bb86ec4ab0a65c8416c36 (patch)
treec37de353896600006b68d9bf91aa18e9b5a747b3
parent376164b960bfada6a4251eeb9b631636bfd8c619 (diff)
downloadgcc-99c9c69acb9150b1b93bb86ec4ab0a65c8416c36.zip
gcc-99c9c69acb9150b1b93bb86ec4ab0a65c8416c36.tar.gz
gcc-99c9c69acb9150b1b93bb86ec4ab0a65c8416c36.tar.bz2
2007-07-24 Dorit Nuzman <dorit@il.ibm.com>
* lib/target-support.exp (check_effective_target_natural_alignment): (check_effective_target_vector_alignment_reachable): New. * config/spu/spu.c (spu_vector_alignment_reachable): New. (TARGET_VECTOR_ALIGNMENT_REACHABLE): Define. * * gcc.dg/vect/pr25413a.c: Use vector_alignment_reachable target check. * gcc.dg/vect/pr25413.c: Likewise. * gcc.dg/vect/pr31699.c: Likewise. From-SVN: r126872
-rw-r--r--gcc/config/spu/spu.c18
-rw-r--r--gcc/testsuite/ChangeLog11
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr25413.c8
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr25413a.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr31699.c4
-rw-r--r--gcc/testsuite/lib/target-supports.exp41
6 files changed, 78 insertions, 8 deletions
diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c
index e283d87..53d0c46 100644
--- a/gcc/config/spu/spu.c
+++ b/gcc/config/spu/spu.c
@@ -136,6 +136,7 @@ static tree spu_builtin_mul_widen_even (tree);
static tree spu_builtin_mul_widen_odd (tree);
static tree spu_builtin_mask_for_load (void);
static int spu_builtin_vectorization_cost (bool);
+static bool spu_vector_alignment_reachable (tree, bool);
extern const char *reg_names[];
rtx spu_compare_op0, spu_compare_op1;
@@ -272,6 +273,9 @@ const struct attribute_spec spu_attribute_table[];
#undef TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST
#define TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST spu_builtin_vectorization_cost
+#undef TARGET_VECTOR_ALIGNMENT_REACHABLE
+#define TARGET_VECTOR_ALIGNMENT_REACHABLE spu_vector_alignment_reachable
+
struct gcc_target targetm = TARGET_INITIALIZER;
void
@@ -5477,6 +5481,20 @@ spu_builtin_vectorization_cost (bool runtime_test)
return 0;
}
+/* Return true iff, data reference of TYPE can reach vector alignment (16)
+ after applying N number of iterations. This routine does not determine
+ how may iterations are required to reach desired alignment. */
+
+static bool
+spu_vector_alignment_reachable (tree type ATTRIBUTE_UNUSED, bool is_packed)
+{
+ if (is_packed)
+ return false;
+
+ /* All other types are naturally aligned. */
+ return true;
+}
+
void
spu_init_expanders (void)
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 39a1404..486bc884 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,14 @@
+2007-07-24 Dorit Nuzman <dorit@il.ibm.com>
+
+ * lib/target-support.exp (check_effective_target_natural_alignment):
+ (check_effective_target_vector_alignment_reachable): New.
+ * config/spu/spu.c (spu_vector_alignment_reachable): New.
+ (TARGET_VECTOR_ALIGNMENT_REACHABLE): Define.
+ * * gcc.dg/vect/pr25413a.c: Use vector_alignment_reachable target
+ check.
+ * gcc.dg/vect/pr25413.c: Likewise.
+ * gcc.dg/vect/pr31699.c: Likewise.
+
2007-07-24 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/30814
diff --git a/gcc/testsuite/gcc.dg/vect/pr25413.c b/gcc/testsuite/gcc.dg/vect/pr25413.c
index 7444725..e74093d 100644
--- a/gcc/testsuite/gcc.dg/vect/pr25413.c
+++ b/gcc/testsuite/gcc.dg/vect/pr25413.c
@@ -31,8 +31,8 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_aligned_arrays } } } */
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" { target { ! vect_aligned_arrays } } } } */
-/* { dg-final { scan-tree-dump-times "vector alignment may not be reachable" 1 "vect" { target { ! vect_aligned_arrays } } } } */
-/* { dg-final { scan-tree-dump-times "not vectorized: unsupported unaligned store" 1 "vect" { target { ! vect_aligned_arrays } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vector_alignment_reachable } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" { target { ! vector_alignment_reachable } } } } */
+/* { dg-final { scan-tree-dump-times "vector alignment may not be reachable" 1 "vect" { target { ! vector_alignment_reachable } } } } */
+/* { dg-final { scan-tree-dump-times "not vectorized: unsupported unaligned store" 1 "vect" { target { ! vector_alignment_reachable } } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr25413a.c b/gcc/testsuite/gcc.dg/vect/pr25413a.c
index 89291c6..b9bef5f 100644
--- a/gcc/testsuite/gcc.dg/vect/pr25413a.c
+++ b/gcc/testsuite/gcc.dg/vect/pr25413a.c
@@ -124,6 +124,6 @@ int main (void)
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "vector alignment may not be reachable" 1 "vect" { target { ! vect_aligned_arrays } } } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" { target { ! vect_aligned_arrays } } } } */
+/* { dg-final { scan-tree-dump-times "vector alignment may not be reachable" 1 "vect" { target { ! vector_alignment_reachable } } } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" { target { ! vector_alignment_reachable } } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr31699.c b/gcc/testsuite/gcc.dg/vect/pr31699.c
index d1e396e..cbc596d 100644
--- a/gcc/testsuite/gcc.dg/vect/pr31699.c
+++ b/gcc/testsuite/gcc.dg/vect/pr31699.c
@@ -31,6 +31,6 @@ int main()
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { target vect_intfloat_cvt } } } */
-/* { dg-final { scan-tree-dump-times "vector alignment may not be reachable" 1 "vect" { target { ! vect_aligned_arrays } } } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" { target { ! vect_aligned_arrays } } } } */
+/* { dg-final { scan-tree-dump-times "vector alignment may not be reachable" 1 "vect" { target { ! vector_alignment_reachable } } } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" { target { ! vector_alignment_reachable } } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index c52a050..ea3ecc4 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -2031,6 +2031,47 @@ proc check_effective_target_vect_aligned_arrays { } {
return $et_vect_aligned_arrays_saved
}
+# Return 1 if types are naturally aligned (aligned to their type-size),
+# 0 otherwise.
+#
+# This won't change for different subtargets so cache the result.
+
+proc check_effective_target_natural_alignment { } {
+ global et_natural_alignment
+
+ if [info exists et_natural_alignment_saved] {
+ verbose "check_effective_target_natural_alignment: using cached result" 2
+ } else {
+ set et_natural_alignment_saved 0
+ if { [istarget spu-*-*] } {
+ set et_natural_alignment_saved 1
+ }
+ }
+ verbose "check_effective_target_natural_alignment: returning $et_natural_alignment_saved" 2
+ return $et_natural_alignment_saved
+}
+
+# Return 1 if vector alignment is reachable, 0 otherwise.
+#
+# This won't change for different subtargets so cache the result.
+
+proc check_effective_target_vector_alignment_reachable { } {
+ global et_vector_alignment_reachable
+
+ if [info exists et_vector_alignment_reachable_saved] {
+ verbose "check_effective_target_vector_alignment_reachable: using cached result" 2
+ } else {
+ if { [check_effective_target_vect_aligned_arrays]
+ || [check_effective_target_natural_alignment] } {
+ set et_vector_alignment_reachable_saved 1
+ } else {
+ set et_vector_alignment_reachable_saved 0
+ }
+ }
+ verbose "check_effective_target_vector_alignment_reachable: returning $et_vector_alignment_reachable_saved" 2
+ return $et_vector_alignment_reachable_saved
+}
+
# Return 1 if the target supports vector conditional operations, 0 otherwise.
proc check_effective_target_vect_condition { } {